bug in integration SQL parser to plpgsq

Started by Pavel Stehuleover 16 years ago4 messageshackers
Jump to latest
#1Pavel Stehule
pavel.stehule@gmail.com

Hello

it doesn't support EXPLAIN as possible begin of SQL statement:

postgres=# create or replace function foo(_a int) returns void as
$$declare s varchar; begin for s in explain select * from omega where
a = _a loop raise notice '%', s; end loop; return; end; $$ language
plpgsql;
CREATE FUNCTION
postgres=# select foo(10);
ERROR: column "_a" does not exist
CONTEXT: PL/pgSQL function "foo" line 1 at FOR over SELECT rows

postgres=# create or replace function foo(_a int) returns void as
$$declare s varchar; begin for s in select * from omega where a = _a
loop raise notice '%', s; end loop; return; end; $$ language plpgsql;
CREATE FUNCTION
postgres=# select foo(10);
foo
-----

(1 row)

Regards
Pavel Stehule

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Pavel Stehule (#1)
Re: bug in integration SQL parser to plpgsq

Pavel Stehule <pavel.stehule@gmail.com> writes:

it doesn't support EXPLAIN as possible begin of SQL statement:

postgres=# create or replace function foo(_a int) returns void as
$$declare s varchar; begin for s in explain select * from omega where
a = _a loop raise notice '%', s; end loop; return; end; $$ language
plpgsql;
CREATE FUNCTION
postgres=# select foo(10);
ERROR: column "_a" does not exist
CONTEXT: PL/pgSQL function "foo" line 1 at FOR over SELECT rows

No, that's got nothing to do with EXPLAIN per se. It's not passing
down the parameter resolution hook into utility statements in general.
This may take a little bit of thought to fix :-(

regards, tom lane

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Pavel Stehule (#1)
Re: bug in integration SQL parser to plpgsq

Pavel Stehule <pavel.stehule@gmail.com> writes:

it doesn't support EXPLAIN as possible begin of SQL statement:

I've applied a fix for that.

regards, tom lane

#4Pavel Stehule
pavel.stehule@gmail.com
In reply to: Tom Lane (#3)
Re: bug in integration SQL parser to plpgsq

2010/1/15 Tom Lane <tgl@sss.pgh.pa.us>:

Pavel Stehule <pavel.stehule@gmail.com> writes:

it doesn't support EXPLAIN as possible begin of SQL statement:

I've applied a fix for that.

Thank you

Pavel Stehule

Show quoted text

                       regards, tom lane