bug in integration SQL parser to plpgsq

Lists: pgsql-hackers
From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: bug in integration SQL parser to plpgsq
Date: 2010-01-12 10:10:41
Message-ID: 162867791001120210j7db534e1tf45eff7a1f61af66@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: bug in integration SQL parser to plpgsq
Date: 2010-01-12 15:49:47
Message-ID: 4611.1263311387@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Pavel Stehule <pavel(dot)stehule(at)gmail(dot)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


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: bug in integration SQL parser to plpgsq
Date: 2010-01-15 22:39:31
Message-ID: 22850.1263595171@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
> it doesn't support EXPLAIN as possible begin of SQL statement:

I've applied a fix for that.

regards, tom lane


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: bug in integration SQL parser to plpgsq
Date: 2010-01-16 00:26:58
Message-ID: 162867791001151626g45b74315g8fe21420a70aca32@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2010/1/15 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
>> it doesn't support EXPLAIN as possible begin of SQL statement:
>
> I've applied a fix for that.

Thank you

Pavel Stehule
>
>                        regards, tom lane
>