pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Postgresql <frederes@free.fr>
To: pgsql-sql@postgresql.org
Subject: cascading delete - recursivity
Date: Sat, 9 Jun 2001 18:22:51 +0200
Message-ID: <9fti5q$2ccg$1@news.tht.net> (raw)

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 !





view thread (3+ messages)  latest in thread

Message-ID: <9fti5q$2ccg$1@news.tht.net>
Permalink:  ../9fti5q$2ccg$1@news.tht.net/
Also on:    postgresql.org/message-id/9fti5q$2ccg$1@news.tht.net

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: frederes@free.fr
  Subject: Re: cascading delete - recursivity
  In-Reply-To: <9fti5q$2ccg$1@news.tht.net>

* 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