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

Re: [GENERAL] INSTEAD rule bug?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dmitry Tkach <dmitry(at)openratings(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] INSTEAD rule bug?
Date: 2003-07-16 17:33:58
Message-ID: 23587.1058376838@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-general
I said:
> Dmitry Tkach <dmitry(at)openratings(dot)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

In response to

pgsql-bugs by date

Next:From: Tom LaneDate: 2003-07-16 17:53:11
Subject: Re: Vacuum going -D; crash or just impatience?
Previous:From: Josh BerkusDate: 2003-07-16 16:06:44
Subject: Vacuum going -D; crash or just impatience?

pgsql-general by date

Next:From: Luis MagaƱaDate: 2003-07-16 17:36:34
Subject: Re: ODBC query problem
Previous:From: Maksim LikharevDate: 2003-07-16 17:23:50
Subject: Re: ODBC query problem

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