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

2007-08-10 Thread Tom Lane
Peter Marius [EMAIL PROTECTED] 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,

[GENERAL] CREATE RULE on VIEW with INSERT after UPDATE does not work

2007-08-10 Thread Peter Marius
Hi all, I have a table mytable to log the validity of data records with start and stop time. To see, which records are still valid, 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

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

2007-08-10 Thread Peter Marius
Hi Tom, thanks for your answer, I have also thought of combining the statements, but my SQL-knowledge is too small for that. I thought, the example with mylog would be better to demonstrate the problem, but it's missing the point. Below, if have added the code with my real problem. What I want

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

2007-08-10 Thread Tom Lane
Peter Marius [EMAIL PROTECTED] writes: I thought, the example with mylog would be better to demonstrate the problem, but it's missing the point. Below, if have added the code with my real problem. CREATE RULE sru AS ON UPDATE TO myview DO INSTEAD ( UPDATE mytable SET stop = now() WHERE id

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

2007-08-10 Thread Peter Marius
AFAICS, all you need to do is swap the ordering of those two operations. It might help to understand that what you write as an INSERT/VALUES is really more like INSERT ... SELECT ... FROM myview WHERE ..., the WHERE condition being the same as was given in the UPDATE myview command that the