Skip site navigation (1) Skip section navigation (2)

Re: Multiple Rules :: Postgres Is confused !!

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Najib Abi Fadel <nabifadel(at)usj(dot)edu(dot)lb>
Cc: Richard Huxton <dev(at)archonet(dot)com>,generalpost <pgsql-general(at)postgresql(dot)org>
Subject: Re: Multiple Rules :: Postgres Is confused !!
Date: 2004-09-29 12:19:08
Message-ID: 20040929121908.GE5152@svana.org (view raw or flat)
Thread:
Lists: 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(at)svana(dot)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.

In response to

pgsql-general by date

Next:From: Richard HuxtonDate: 2004-09-29 12:20:02
Subject: Re: Multiple Rules :: Postgres Is confused !!
Previous:From: Martijn van OosterhoutDate: 2004-09-29 11:43:11
Subject: Re: About PostgreSQL's limit on arithmetic operations

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group