Re: Implementing SQL/PSM for PG 8.2 - Mailing list pgsql-hackers

From Neil Conway
Subject Re: Implementing SQL/PSM for PG 8.2
Date
Msg-id 42C09C89.3030805@samurai.com
Whole thread Raw
In response to Re: Implementing SQL/PSM for PG 8.2  (Jan Wieck <JanWieck@Yahoo.com>)
Responses Re: Implementing SQL/PSM for PG 8.2
Re: Implementing SQL/PSM for PG 8.2
List pgsql-hackers
Jan Wieck wrote:
> The whole parser is a hack that attempts to parse the procedural parts 
> of the function but preserving the SQL parts as query strings while 
> substituting variables with numbered parameters. That is anything but 
> clean. It was the only way I saw at the time of implementation to build 
> a parser that automatically supports future changes of the main Postgres 
> query language.

I agree the current parser is a hack, but it's difficult to see how else 
it could be implemented. One possibility I've mentioned in the past is 
to rewrite the main SQL parser by hand (e.g. as a recursive descent 
parser), so that we could directly call into the main SQL parser from 
the PL/PgSQL parser. I believe that would let us embed SQL in PL/PgSQL 
without needing to teach the PL/PgSQL anything about the main SQL 
grammar. But of course this has the downside of needing to write and 
maintain a recursive descent parser.

Any better ideas?

-Neil


pgsql-hackers by date:

Previous
From: Neil Conway
Date:
Subject: Re: Implementing SQL/PSM for PG 8.2
Next
From: Andrew Dunstan
Date:
Subject: language handlers in public schema