pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Emils Klotins <emils@mail.usis.bkc.lv>
To: pgsql-sql@postgresql.org
Subject: Hello & create rule question
Date: Fri, 5 Mar 1999 16:31:08 EET
Message-ID: <199903051429.QAA04937@omega.bkc.lv> (raw)

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



view thread (2+ messages)  latest in thread

Message-ID: <199903051429.QAA04937@omega.bkc.lv>
Permalink:  ../199903051429.QAA04937@omega.bkc.lv/
Also on:    postgresql.org/message-id/199903051429.QAA04937@omega.bkc.lv

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: emils@mail.usis.bkc.lv
  Subject: Re: Hello & create rule question
  In-Reply-To: <199903051429.QAA04937@omega.bkc.lv>
  References: <199903051429.QAA04937@omega.bkc.lv>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox