On Wed, 20 Nov 2002, Malcolm Hutty wrote:
> According to the manual you can stack multiple queries in a RULE:
>
> CREATE RULE name AS ON event
> TO object [ WHERE condition ]
> DO [ INSTEAD ] action
>
> where action can be:
>
> NOTHING
> |
> query
> |
> ( query ; query ... )
> |
> [ query ; query ... ]
>
>
> This seems to work provided 'query' is not "DELETE"; if it is, only
> the first one is executed.
I think it's something like:
delete from v_ab
turns into something equivalent to the two statements (I don't know
what the actual form of the queries is however)
delete from a where a_data=ANY(select a_data from v_ab);
delete from b where b_data=ANY(select b_data from v_ab);
So when the second runs there is no matching rows (having already had all
the a rows deleted).