Re: Standalone Parser for PL/pgSQL

From: Neil Conway <neilc(at)samurai(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Matt Miller <mattm(at)epx(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Standalone Parser for PL/pgSQL
Date: 2005-07-14 04:32:27
Message-ID: 42D5EADB.5050905@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alvaro Herrera wrote:
> I don't think you can use just plpgsql's parser. The problem is that it
> relies on the main backend parser to figure out anything it doesn't
> understand.

I think it depends on what kind of information you want to extract from
a PL/PgSQL function definition. The PL/PgSQL parser handles the
structure of the PL/PgSQL function definition itself, but it does not
parse expressions or SQL queries. Those are essentially treated as
strings that are later handed to the main SQL machinery to be parsed and
evaluated. If you're content to treat expressions and SQL queries as
opaque strings, you shouldn't need to concern yourself with the main SQL
parser.

> The main parser depends (at least) on the List handling and memory
> handling. So your "simple standalone parser" will have to contain both
> things at least.

The PL/PgSQL parser also depends on these, although to a lesser degree.

-Neil

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Neil Conway 2005-07-14 04:46:01 Re: To Postgres or not
Previous Message Gregory Youngblood 2005-07-14 04:27:48 Re: Errors building older versions of PostgreSQL