bug in integration SQL parser to plpgsq
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
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
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