cascading delete - recursivity

From: "Postgresql" <frederes(at)free(dot)fr>
To: pgsql-sql(at)postgresql(dot)org
Subject: cascading delete - recursivity
Date: 2001-06-09 16:22:51
Message-ID: 9fti5q$2ccg$1@news.tht.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

I have a table of categories (it's pseudo-sql...) :

CATEGORIES
(
id_category PRIMARY KEY,
id_category_parent (FOREIGN KEY ? CONSTRAINT ??) ,
cat_text
)

There is recursivity : id_category_parent is -1 (= no parent cat) or the
id_category of a category in this table.
What is the SQL statements to create such a table so that when you delete a
category, all sub-categories
are automatically deleted ?
I've tried many things like CONSTRAINT... but the query fails !

Thanks !

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Joe Conway 2001-06-09 16:23:25 Re: Inconsistent usage of Index
Previous Message Peter Eisentraut 2001-06-09 16:21:02 Re: Index usage