Re: CREATE RULE on VIEW with INSERT after UPDATE does not work

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Peter Marius" <Peter(dot)Marius(at)gmx(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: CREATE RULE on VIEW with INSERT after UPDATE does not work
Date: 2007-08-10 17:10:04
Message-ID: 4309.1186765804@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Peter Marius" <Peter(dot)Marius(at)gmx(dot)de> writes:
> I created a view on all entries with stop=null.

> The DB-Interaction should be done over the view,
> so I added rules for INSERT, UPDATE an DELETE.

> Insert and Update work fine, but the DELETE_RULE
> stopps after the first UPDATE statement in the Rule-Body,
> any further statements are ignored!!

Once you change the stop field to not be null, the row's no longer part
of the view, so there's nothing to update. You need to re-order the
operations (and, probably, combine the two UPDATE commands) so that you
don't remove the row from the view until the last step.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2007-08-10 17:29:03 Re: How I can know a back up database is up to date
Previous Message Ben 2007-08-10 17:00:55 Re: Configuration starting point...