Re: Cascading Deletes

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Craig May <craig(dot)may(at)s2(dot)enthdimension(dot)com(dot)au>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Cascading Deletes
Date: 2000-09-06 17:50:09
Message-ID: Pine.BSF.4.10.10009061048330.89808-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


I think a references constraint on ID
referencing _ID with ON DELETE CASCADE
should do what you want.

Stephan Szabo
sszabo(at)bigpanda(dot)com

On Wed, 6 Sep 2000, Craig May wrote:

> Hi,
>
> I have a tables having this structure:
>
> ID (int) | _ID (int) | Name (String)
>
>
> _ID is the parent of ID.
>
> I'm looking for the best method to perform a cascade delete. For example, I
> delete _ID, it in turn deletes ID, and should ID also be an entry within _ID, it
> would continue through the chain.
>
> For example:
>
> 0 0 Base
> 1 0 Sib1
> 2 0 Sib2
> 3 0 Sib3
> 4 1 Sib1_1
> 5 1 Sib1_2
>
>
> Deleting Base would remove all the entries. Deleting Sib1 would delete Sib1_1
> and Sib1_2.
> Can anyone help out here?
>
> Regards,
> Craig May
>
> Enth Dimension
> http://www.enthdimension.com.au
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jie Liang 2000-09-06 18:12:50 Re: Cascading Deletes
Previous Message Jie Liang 2000-09-06 17:41:58 Re: Protection of tables by group and not by users