Re: RULE: ON DELETE doesn't stack deletes

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Malcolm Hutty <msah-postgres(at)hutty(dot)com>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: RULE: ON DELETE doesn't stack deletes
Date: 2002-11-26 16:40:01
Message-ID: 20021126083446.S77510-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


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).

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Stephan Szabo 2002-11-26 16:41:06 Re: [BUGS] Bug #823: upper() does not handle , and correctly.
Previous Message Adam Buraczewski 2002-11-26 16:32:25 Re: PostgreSQL 7.3rc1: initdb fais with '-W' switch given in the command line.