Re: Multiple Rules :: Postgres Is confused !!

From: Richard Huxton <dev(at)archonet(dot)com>
To: Najib Abi Fadel <nabifadel(at)usj(dot)edu(dot)lb>
Cc: generalpost <pgsql-general(at)postgresql(dot)org>
Subject: Re: Multiple Rules :: Postgres Is confused !!
Date: 2004-09-30 07:42:23
Message-ID: 415BB8DF.4080103@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Najib Abi Fadel wrote:
>>ALL rules get executed. Conditions get combined (actually, parse trees
>>get merged).

> If i am getting this right the update command: "UPDATE foo_v SET b='xxx';"
> will first get the "a" values (2 and 5) from the view and then execute the
> update on this rows.
> ?
>
> So im my case, when i call the update : "update transactions_sco_v set
> traiter='t' where id = 53597;"
> IF
> select cursus_id, vers_id, traiter, code_type_academic, cod_etu from
> transactions_sco_v where id = 53597;
> Returns
> -[ RECORD 1 ]------+-------
> cursus_id | 62
> vers_id | 6
> traiter | f
> code_type_academic | ECT
> cod_etu | 041400
>
> this will execute the 3 update corresponding to the 3 rules i defined for
> the values of cursus_id, vers_id, traiter, code_type_academic, cod_etu
> returned above !!!
> and i will have the following 3 updates executes !
>
> UPDATE transactions_sco SET traiter = 't' WHERE cursus_id = 62 AND vers_id =
> 6 traiter = 'f' AND code_type_academic = 'ECT' and cod_etu = '041400';
>
> UPDATE transactions_sco SET traiter = 't' WHERE cursus_id = 62 AND vers_id =
> 6 traiter = 'f' AND code_type_academic = 'ECT';
>
>
> UPDATE transactions_sco SET traiter = 't' WHERE id = 53597;
>
>
> I AM GETTING THIS RIGHT ??

Sounds right to me. I'm posting an expanded example since it's a
complicated issue and others on the list might benefit.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2004-09-30 07:46:13 Multiple Rules - an example
Previous Message Najib Abi Fadel 2004-09-30 07:29:48 Re: Multiple Rules :: Postgres Is confused !!