Re: [BUGS] INSTEAD rule bug? - Mailing list pgsql-general

From Tom Lane
Subject Re: [BUGS] INSTEAD rule bug?
Date
Msg-id 9240.1058305342@sss.pgh.pa.us
Whole thread Raw
In response to Re: [BUGS] INSTEAD rule bug?  (Dmitry Tkach <dmitry@openratings.com>)
Responses Re: [BUGS] INSTEAD rule bug?  (Dmitry Tkach <dmitry@openratings.com>)
List pgsql-general
Dmitry Tkach <dmitry@openratings.com> writes:
> Sure, but it is inside the rule that has 'where x is not null and y is
> not null' on it as a qualifier, so
> with my test example it should just never get executed in the first place.

You're confusing rules with triggers.  The INSERT *will* get executed;
the rule's qualifier gets moved to the WHERE of the INSERT...SELECT,
and the way you get no effect is for the qual to fail on every row the
SELECT generates.

One way to think about the problem (though I'm not sure this is right in
detail) is that there's no place to hang a top-level WHERE on a UNION.

            regards, tom lane

pgsql-general by date:

Previous
From: "Derek Hamilton"
Date:
Subject: Re: Firebird vrs Postgresql
Next
From: "Darko Prenosil"
Date:
Subject: Re: Firebird vrs Postgresql