Jan Wieck <janwieck@Yahoo.com> writes:
> Tom Lane wrote:
>> The problem here is that the query rewriter tries to hang the query's
>> qualification (WHERE clause) onto the rule's action query, so that
>> the action query won't be done unless the query finds at least one
>> row to update.
>> NOTIFY commands, being utility statements, don't have qualifications.
>> In 7.0 and before, the qual clause just vanished into the ether, and
>> so in this example the NOTIFY would execute whether the UPDATE updated
>> any rows or not. In 7.1 there is physically noplace to hang the qual
>> (no jointree) and thus a crash.
> Would be something for a STATEMENT trigger. We don't have 'em
> yet and I'm not sure what kind of information they will
> receive if we finally implement them. But the number of rows
> affected by the statement is a good candidate.
That's no help for a 7.1 solution however. We can't start inventing
a new feature at this stage.
What I am inclined to do is have the rewriter reject conditional rules
that contain NOTIFY. That seems like the minimal restriction that will
prevent a crash or incorrect behavior. Comments?
regards, tom lane