Re: DO INSTEAD and conditional rules - Mailing list pgsql-hackers

From Neil Conway
Subject Re: DO INSTEAD and conditional rules
Date
Msg-id 426DDB5F.30101@samurai.com
Whole thread Raw
In response to Re: DO INSTEAD and conditional rules  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: DO INSTEAD and conditional rules  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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


pgsql-hackers by date:

Previous
From: "Qingqing Zhou"
Date:
Subject: Re: simplify register_dirty_segment()
Next
From: Tom Lane
Date:
Subject: Re: DO INSTEAD and conditional rules