Peri postgres rules

Michalis Kabrianis kabrianis at hellug.gr
Sun May 28 13:35:48 EEST 2000


Geia sas.
Asxeto me linux, to thema einai tis PostgresSQL, gi ayto sygxwriste me gia to
off-topic.

Exw enan pinaka me onoma 'meli' kai enan pinaka me onoma 'helper' pou periexei
(ektos twn allwn) kai to athroisma twn eggrafwn ston pinaka 'meli' se mia stili
members.

Exw ftiaksei kai dyo rules gia na ginetai aytomata i enimerwsi, ws eksis:

create rule add_member_helper as
on insert to meli
do
update helper set members=members+1;

create rule dem_member_helper as
on delete to meli
do 
update helper set members=members-1;

Enw to prwto rule doulevei, to deytero den doulevei opws thelw kai 
fantazomai. 

Eksigw:
An tou dwsw: "delete from meli where id=17" i stili members paramenei analloiwti
ston pinaka helper
An tou dwsw: "delete from meli" i stili members meiwnetai (kata ena bebaia opws
tou exw pei).

Kserei kanenas pws prepei na allaksw to rule gia na kanei ayto pou thelw?
Dystyxws sta paradeigmata sto documentation tis postgres den anaferetai kati
paromoio :-(


TIA

Michalis Kabrianis
kabrianis at hellug.gr
http://homepages.pathfinder.gr/mkab

--
linux-greek-users mailing list -- http://lists.hellug.gr




More information about the Linux-greek-users mailing list