Re: BUG #5032: unexpected syntax error for plpgsql function returns table - Mailing list pgsql-bugs

From Pavel Stehule
Subject Re: BUG #5032: unexpected syntax error for plpgsql function returns table
Date
Msg-id 162867790909022027i79b73b46pc91cd194f183665d@mail.gmail.com
Whole thread Raw
In response to BUG #5032: unexpected syntax error for plpgsql function returns table  ("Keith Cascio" <keith@cs.ucla.edu>)
Responses Re: BUG #5032: unexpected syntax error for plpgsql function returns table  (Keith Cascio <keith@CS.UCLA.EDU>)
Re: BUG #5032: unexpected syntax error for plpgsql function returns table  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-bugs
Hello

it's not bug - PostgreSQL doesn't support parameter placeholder on
this position. Use dynamic query instead - plpgsql statement EXECUTE.

regards
Pavel Stehule

2009/9/3 Keith Cascio <keith@cs.ucla.edu>:
>
> The following bug has been logged online:
>
> Bug reference: =C2=A0 =C2=A0 =C2=A05032
> Logged by: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Keith Cascio
> Email address: =C2=A0 =C2=A0 =C2=A0keith@cs.ucla.edu
> PostgreSQL version: 8.4.0
> Operating system: =C2=A0 CentOS 5.3 (Linux)
> Description: =C2=A0 =C2=A0 =C2=A0 =C2=A0unexpected syntax error for plpgs=
ql function returns
> table
> Details:
>
> Do this:
> create function reproduce() returns table(foo integer) language plpgsql as
> 'begin return query select 1 foo; end;';
>
> Output I got:
> ERROR: =C2=A0syntax error at or near "$1"
> LINE 1: =C2=A0select 1 =C2=A0$1
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^
> QUERY: =C2=A0 select 1 =C2=A0$1
> CONTEXT: =C2=A0SQL statement in PL/PgSQL function "reproduce" near line 1
>
> Output I expected:
> CREATE FUNCTION
>
> The mechanism of this error involves the "foo" return column and the "foo"
> alias being identical. =C2=A0Identifier collision? =C2=A0If I change one =
of the "foo"s
> to "bar", the definition succeeds. =C2=A0There are fancier ways to cause =
similar
> unexpected syntax errors, but this is close to a minimal example.
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs
>

pgsql-bugs by date:

Previous
From: "Keith Cascio"
Date:
Subject: BUG #5032: unexpected syntax error for plpgsql function returns table
Next
From: Tom Lane
Date:
Subject: Re: BUG #5031: DATE_TRUNC returns the wrong value when specifying MONTH