Re: [HACKERS] a few small bugs in plpgsql

2010-10-08 Thread Pavel Stehule
2010/10/8 Tom Lane : > Pavel Stehule writes: >> Now I understand to interpretation. But there is little bit difficult >> to understand to error message. Can be message enhanced to show a >> complete expression? > > It does already: > > regression=# select foo(); > ERROR:  column "label" does not e

Re: [HACKERS] a few small bugs in plpgsql

2010-10-08 Thread Tom Lane
Pavel Stehule writes: > Now I understand to interpretation. But there is little bit difficult > to understand to error message. Can be message enhanced to show a > complete expression? It does already: regression=# select foo(); ERROR: column "label" does not exist LINE 2: <> ^ QU

Re: [HACKERS] a few small bugs in plpgsql

2010-10-07 Thread Pavel Stehule
2010/10/8 Tom Lane : > Robert Haas writes: >> On Thu, Oct 7, 2010 at 2:53 PM, Pavel Stehule >> wrote: >>> b) SRF functions must not be finished by RETURN statement - I know, so >>> there is outer default block, but it looks like inconsistency for SRF >>> functions, because you can use a RETURN N

Re: [HACKERS] a few small bugs in plpgsql

2010-10-07 Thread Pavel Stehule
Hello 2010/10/8 Tom Lane : > Pavel Stehule writes: >> a) parser allow a labels on invalid positions with strange runtime bug: > >> postgres=# CREATE OR REPLACE FUNCTION foo() >> RETURNS void AS $$ >> BEGIN >>   FOR i IN 1..2 >>   <<> >>   LOOP >>     RAISE NOTICE '%',i; >>   END LOOP; >> END; >>

Re: [HACKERS] a few small bugs in plpgsql

2010-10-07 Thread Tom Lane
Pavel Stehule writes: > a) parser allow a labels on invalid positions with strange runtime bug: > postgres=# CREATE OR REPLACE FUNCTION foo() > RETURNS void AS $$ > BEGIN > FOR i IN 1..2 > <<> > LOOP > RAISE NOTICE '%',i; > END LOOP; > END; > $$ LANGUAGE plpgsql; > CREATE FUNCTION >

Re: [HACKERS] a few small bugs in plpgsql

2010-10-07 Thread Tom Lane
Robert Haas writes: > On Thu, Oct 7, 2010 at 2:53 PM, Pavel Stehule wrote: >> b) SRF functions must not be finished by RETURN statement - I know, so >> there is outer default block, but it looks like inconsistency for SRF >> functions, because you can use a RETURN NEXT without RETURN. It maybe >>

Re: [HACKERS] a few small bugs in plpgsql

2010-10-07 Thread Josh Berkus
>> b) SRF functions must not be finished by RETURN statement - I know, so >> there is outer default block, but it looks like inconsistency for SRF >> functions, because you can use a RETURN NEXT without RETURN. It maybe >> isn't bug - but I am filling it as inconsistency. Hmmm. Is there any like

Re: [HACKERS] a few small bugs in plpgsql

2010-10-07 Thread Robert Haas
On Thu, Oct 7, 2010 at 2:53 PM, Pavel Stehule wrote: > Hello, > > today I found a few bugs: > > a) parser allow a labels on invalid positions with strange runtime bug: > > postgres=# CREATE OR REPLACE FUNCTION foo() > RETURNS void AS $$ > BEGIN >  FOR i IN 1..2 >  <<> >  LOOP >    RAISE NOTICE '%'

[HACKERS] a few small bugs in plpgsql

2010-10-07 Thread Pavel Stehule
Hello, today I found a few bugs: a) parser allow a labels on invalid positions with strange runtime bug: postgres=# CREATE OR REPLACE FUNCTION foo() RETURNS void AS $$ BEGIN FOR i IN 1..2 <<> LOOP RAISE NOTICE '%',i; END LOOP; END; $$ LANGUAGE plpgsql; CREATE FUNCTION ERROR: column