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

From Richard Huxton
Subject Re: Multiple Rules :: Postgres Is confused !!
Date
Msg-id 415BB8DF.4080103@archonet.com
Whole thread Raw
In response to Re: Multiple Rules :: Postgres Is confused !!  ("Najib Abi Fadel" <nabifadel@usj.edu.lb>)
List 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

pgsql-general by date:

Previous
From: "Mike Morris"
Date:
Subject: psql slow disconnect via ssl
Next
From: Richard Huxton
Date:
Subject: Multiple Rules - an example