Re: [GENERAL] INSTEAD rule bug?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [GENERAL] INSTEAD rule bug?
Дата
Msg-id 23587.1058376838@sss.pgh.pa.us
обсуждение исходный текст
Ответ на INSTEAD rule bug?  (Dmitry Tkach <dmitry@openratings.com>)
Список pgsql-bugs
I said:
> Dmitry Tkach <dmitry@openratings.com> writes:
>> I thought you said it was only complaining about references to new and
>> old, not about *any* union clause...

> I don't see a need to reject "any" union clause.  AFAIK the cases that
> don't work are just the ones where NEW or OLD are referenced.

After further study I've realized that the problem is that we have no
support for attaching qual conditions directly to a UNION node, and
thus INSERT ... SELECT ... UNION in a rule will misbehave if either
the rule's own WHERE condition or the WHERE of the invoking query is
nonempty.  This is a separate problem from the question of whether there
is a reference to OLD or NEW.

For 7.4 I've added code to reject such cases.  CVS tip will now do this,
given your example test and test_view:

regression=# create rule z2 as on update to test_view where false
regression-# do instead insert into test (select null, null union select 1,2);
ERROR:  Conditional UNION/INTERSECT/EXCEPT statements are not implemented
regression=# create rule z2 as on update to test_view
regression-# do instead insert into test (select null, null union select 1,2);
CREATE RULE
regression=# update test_view set y = 1 where x is null;
ERROR:  Conditional UNION/INTERSECT/EXCEPT statements are not implemented
regression=# update test_view set y = 1 ;
ERROR:  ExecInsert: Fail to add null value in not null attribute x

Further down the pike we should try to support the cases that can be
made to work, but that sounds too much like a new feature to me to
consider for 7.4 at this stage.

            regards, tom lane

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

Предыдущее
От: "sam"
Дата:
Сообщение: Can not compile --with-tcl ???
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] INSTEAD rule bug?