Re: Standalone Parser for PL/pgSQL - Mailing list pgsql-general

From Neil Conway
Subject Re: Standalone Parser for PL/pgSQL
Date
Msg-id 42D5EADB.5050905@samurai.com
Whole thread Raw
In response to Re: Standalone Parser for PL/pgSQL  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: Standalone Parser for PL/pgSQL
List 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

pgsql-general by date:

Previous
From: Gregory Youngblood
Date:
Subject: Re: Errors building older versions of PostgreSQL
Next
From: Neil Conway
Date:
Subject: Re: To Postgres or not