Hello & create rule question

Поиск
Список
Период
Сортировка
Искать
От
Emils Klotins
Тема
Hello & create rule question
Дата
Msg-id
199903051429.QAA04937@omega.bkc.lv
Список
Дерево обсуждения
Hello & create rule question "Emils Klotins" <emils@mail.usis.bkc.lv>
Re: [SQL] Hello & create rule question jwieck@debis.com (Jan Wieck)
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@mail.usis.bkc.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
В списке pgsql-sql по дате отправления
От: Remigiusz Sokolowski
Дата:
Сообщение: rules
От: jwieck@debis.com (Jan Wieck)
Дата:
Сообщение: Re: [SQL] rules
FAQ