Re: Multiple Rules :: Postgres Is confused !! - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Multiple Rules :: Postgres Is confused !!
Date
Msg-id 20040929121908.GE5152@svana.org
Whole thread Raw
In response to Re: Multiple Rules :: Postgres Is confused !!  ("Najib Abi Fadel" <nabifadel@usj.edu.lb>)
List pgsql-general
> > Because that's what you asked upd1/2 to do for you. To see what is
> > happening, try selecting row id=53597 then manually running each rule
> > yourself, substituting in the OLD.foo from your selected row. You should
> > find that there are two rows that match 53597 on (cursus_id, vers_id,
> > traiter, code_type_academic) - itself and one other.
>
> Sorry, I didn't understand the manuel test procedure
>
> What is happening here? I am doing an update and the condition is on the ID
> and it is corresponding to the last Rule so why should the other rules
> interfer.

Here you misunderstand. You've got an UPDATE on that table set to
trigger a RULE. *All* the rules. Postgresql is not just going to pick
one based on what it thinks you might mean. Since you've got 3 rules
for UPDATE on that table, I imagine all three rules are getting fired.
With DO INSTEAD I expect either the first one or the last one to win, I
don't know enough about the specifics.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: About PostgreSQL's limit on arithmetic operations
Next
From: Richard Huxton
Date:
Subject: Re: Multiple Rules :: Postgres Is confused !!