Re: BUG #4629: PL/pgSQL issue

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #4629: PL/pgSQL issue
Дата
Msg-id 24555.1233603046@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #4629: PL/pgSQL issue  ("Martin Blazek" <mblazek@8bc.com>)
Ответы Re: BUG #4629: PL/pgSQL issue
Список pgsql-bugs
"Martin Blazek" <mblazek@8bc.com> writes:
> CREATE FUNCTION test() RETURNS integer AS $$
> BEGIN
> CREATE RULE "rule" AS ON INSERT TO "test" DO INSTEAD INSERT INTO "test"
> VALUES (1);
> END;$$ LANGUAGE plpgsql;

Hm, I guess nobody ever tried to do that in plpgsql before.  It's
taking the INTO as starting a clause that returns values into plpgsql
variables :-(.

There's a special case in there to prevent INTO just after INSERT
from being taken that way, but it only works when the INSERT is at
the start of the statement :-(.  Guess we need to change that.

In the meantime, you can probably work around this by using EXECUTE,
ie

EXECUTE 'CREATE RULE "rule" AS ON INSERT TO "test" DO INSTEAD INSERT INTO "test" VALUES (1)';

            regards, tom lane

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

Предыдущее
От: "Robert Walker"
Дата:
Сообщение: BUG #4635: postgres.exe crash when RAISE NOTICE during debugging of PL/pgSQL function in PgAdminIII
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: BUG #4629: PL/pgSQL issue