Skip site navigation (1) Skip section navigation (2)

Re: BUG #5032: unexpected syntax error for plpgsql function returns table

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Keith Cascio <keith(at)cs(dot)ucla(dot)edu>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5032: unexpected syntax error for plpgsql function returns table
Date: 2009-09-03 03:27:46
Message-ID: 162867790909022027i79b73b46pc91cd194f183665d@mail.gmail.com (view raw or flat)
Thread:
Lists: 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(at)cs(dot)ucla(dot)edu>:
>
> The following bug has been logged online:
>
> Bug reference:      5032
> Logged by:          Keith Cascio
> Email address:      keith(at)cs(dot)ucla(dot)edu
> PostgreSQL version: 8.4.0
> Operating system:   CentOS 5.3 (Linux)
> Description:        unexpected syntax error for plpgsql 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:  syntax error at or near "$1"
> LINE 1:  select 1  $1
>                   ^
> QUERY:   select 1  $1
> CONTEXT:  SQL 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.  Identifier collision?  If I change one of the "foo"s
> to "bar", the definition succeeds.  There 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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs
>

In response to

Responses

pgsql-bugs by date

Next:From: Keith CascioDate: 2009-09-03 04:48:02
Subject: Re: BUG #5032: unexpected syntax error for plpgsql function returns table
Previous:From: Keith CascioDate: 2009-09-03 01:22:35
Subject: BUG #5032: unexpected syntax error for plpgsql function returns table

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group