Re: DO INSTEAD and conditional rules

From: Neil Conway <neilc(at)samurai(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, david(at)kineticode(dot)com, Jan Wieck <JanWieck(at)yahoo(dot)com>
Subject: Re: DO INSTEAD and conditional rules
Date: 2005-04-26 06:10:39
Message-ID: 426DDB5F.30101@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> DO INSTEAD means that the *original* query will not execute; it does
> not suppress actions produced by other rules. If we did not define
> it that way, I think your example would have to error out --- how
> would you choose which INSTEAD rule wins?

I think DO INSTEAD should control whether the original query is added to
the set of query trees produced by the rule. Since we apply rules in
alphabetical order, I would expect the first rule's conditional to be
checked; when it matches, we would apply the rule and replace the
original query with the rule's action (since it is DO INSTEAD). We would
then apply rules to the result of the first rule; since no more rules
can be applied, the resulting query would be the result of the first rule.

-Neil

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-04-26 06:37:14 Re: DO INSTEAD and conditional rules
Previous Message David Wheeler 2005-04-26 06:05:56 Re: DO INSTEAD and conditional rules