From: | "Emils Klotins" <emils(at)mail(dot)usis(dot)bkc(dot)lv> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Hello & create rule question |
Date: | 1999-03-05 16:31:08 |
Message-ID: | 199903051429.QAA04937@omega.bkc.lv |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hello!
I have just joined this mailing list, so please do not become frustrated, if I happen to ask
something that has already been answered recently.
There is a thing, which didn't work as I expected, so maybe you could tell me, what have I done
wrong?
There are 2 tables:
museums (museum_id int2, description text, address_id int2)
addresses (address_id int2, address text);
(they are actually a bit different, the museums.museum_id & address.address_id being unique
indices with default values from sequences etc.)
I want to delete museum's address from addresses when I delete something from museums.
So I thought to do it with a rule:
CREATE RULE museumdel ON DELETE TO museums DO DELETE FROM addresses WHERE
addresses.address_id=current.address_id;
Now, when I do DELETE FROM museums, the psql monitor displays DELETE 0 and when I
check the tables, the proper entry from museums IS deleted, but the associated addresses row
is not.
What am I doing wrong?
Thanks in advance for any ideas & tips!
Emils Klotins e-mail: emils(at)mail(dot)usis(dot)bkc(dot)lv
Systems Manager URL: http://www.usis.bkc.lv/
USIS Riga 7 Smilsu Str., Riga LV1050, LATVIA
......................................................
RSA PGP key published on: http://pgpkeys.mit.edu:11371
From | Date | Subject | |
---|---|---|---|
Next Message | Jan Wieck | 1999-03-05 16:47:57 | Re: [SQL] Hello & create rule question |
Previous Message | Jan Wieck | 1999-03-05 15:58:15 | Re: [SQL] rules |