Automaticly delete related data

From: Trond Arve Nordheim <trond(at)nordheim(dot)no>
To: pgsql-sql(at)postgresql(dot)org
Subject: Automaticly delete related data
Date: 2001-11-25 02:10:26
Message-ID: 1006654229.11145.8.camel@geekpower
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi!

I'm developing a publishing system and are trying to create
functions/triggers that automaticly wipes out related data to the data
currently beeing deleted...

For example, I have a table containing site objects (an article or
whatever) where I have the following fields;

int_objectid SERIAL NOT NULL,
str_objecttitle VARCHAR(255) NOT NULL,
...
...

Then, I have a table defining the content of that data;
int_objectid INT(11) NOT NULL
str_data TEXT NOT NULL,
...
...

What I want to do is;
When I delete a row from the first table, I want all rows with mathing
int_objectid values in the second table to be deleted.

I've been reading in a couple of online books and the PostgreSQL
documentation all day without beeing able to make something of this...

Can anyone give me a hint, or point me in the direction of some
documentation that can help me out?

Sincerly,
Trond Arve Nordheim

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2001-11-25 04:06:25 Re: Automaticly delete related data
Previous Message Andrew G. Hammond 2001-11-24 09:55:18 Re: How to return more than one row of data from a function in PL/pgSQL