Re: CREATE RULE on VIEW with INSERT after UPDATE does not work - Mailing list pgsql-general

From Tom Lane
Subject Re: CREATE RULE on VIEW with INSERT after UPDATE does not work
Date
Msg-id 4309.1186765804@sss.pgh.pa.us
Whole thread Raw
In response to CREATE RULE on VIEW with INSERT after UPDATE does not work  ("Peter Marius" <Peter.Marius@gmx.de>)
Responses Re: CREATE RULE on VIEW with INSERT after UPDATE does not work
List pgsql-general
"Peter Marius" <Peter.Marius@gmx.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

pgsql-general by date:

Previous
From: Ben
Date:
Subject: Re: Configuration starting point...
Next
From: Raymond O'Donnell
Date:
Subject: Re: How I can know a back up database is up to date