Re: Nonexistent NEW relation in some places of rules

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Nonexistent NEW relation in some places of rules
Дата
Msg-id 5035.1059517964@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Nonexistent NEW relation in some places of rules  (Denis Zaitsev <zzz@anda.ru>)
Список pgsql-sql
Denis Zaitsev <zzz@anda.ru> writes:
> create rule b as
>     on insert to b do instead
>     insert into a
>     select * from produce (new.b);
> ERROR:  Relation "*NEW*" does not exist

> So, what is wrong in using NEW right from the FROM?

CVS tip gives a possibly more helpful error message:

ERROR:  function expression in FROM may not refer to other relations of same query level

The problem is that the rule gets expanded into something rather like
insert into a select ... from new, produce(new.b);

and we can't support that.  If we ever add support for SQL99's
LATERAL(), it might help improve matters.
        regards, tom lane


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

Предыдущее
От: Denis Zaitsev
Дата:
Сообщение: Re: Very strange 'now' behaviour in nested triggers.
Следующее
От: "Vishal Charan (IT Fiji)"
Дата:
Сообщение: Unsubscribe