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

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: BUG #5032: unexpected syntax error for plpgsql function returns table
Дата
Msg-id b42b73150909030520l26ae2bdbhbc8ae091f50317a0@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #5032: unexpected syntax error for plpgsql function returns table  (Keith Cascio <keith@CS.UCLA.EDU>)
Список pgsql-bugs
On Thu, Sep 3, 2009 at 12:48 AM, Keith Cascio<keith@cs.ucla.edu> wrote:
> Pavel,
>
> On Thu, 3 Sep 2009, Pavel Stehule wrote:
>
>> it's not bug - PostgreSQL doesn't support parameter placeholder on this
>> position. Use dynamic query instead - plpgsql statement EXECUTE.
>
> Thank you for your reply. =A0I appreciate your suggestion, but it still s=
eems like
> a bug to me. =A0Please comment on the fact that the following code succee=
ds:
>
> create function reproduce() returns table(foo integer) language plpgsql as
> 'begin return query select 1 bar; end;';
>
> Output in psql is:
> CREATE FUNCTION
>
> Why should it succeed with "bar" but not with "foo"?

This is a very common gotcha in plpgsql.  I always prefix function
arguments and and locals with _;

merlin

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Devrim GÜNDÜZ
Дата:
Сообщение: Re: [NOVICE] psql: FATAL: the database system is in recovery mode
Следующее
От: Keith Cascio
Дата:
Сообщение: Re: BUG #5032: unexpected syntax error for plpgsql function returns table