pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jie Liang <jliang@ipinc.com>
To: craig.may@s2.enthdimension.com.au
Cc: pgsql-sql@postgresql.org
Subject: Re: Cascading Deletes
Date: Wed, 06 Sep 2000 11:12:50 -0700
Message-ID: <39B68922.320969E9@ipinc.com> (raw)
References: <20000906172126.A4216@s2.enthdimension.com.au>

Hi, there,
2 ways may resolve you problem, I believe:
1. re_create your table set _ID as primary key and ID as foreign key with option ON
DELETE CASCADE
    if _ID is unique key.
2. create a rule bind this table, for each row deleting(or create a trigger).


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

--
Jie LIANG

Internet Products Inc.

10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873

jliang@ipinc.com
www.ipinc.com






view thread (4+ messages)  latest in thread

Message-ID: <39B68922.320969E9@ipinc.com>
Permalink:  ../39B68922.320969E9@ipinc.com/
Also on:    postgresql.org/message-id/39B68922.320969E9@ipinc.com

 · 

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: jliang@ipinc.com, craig.may@s2.enthdimension.com.au
  Subject: Re: Cascading Deletes
  In-Reply-To: <39B68922.320969E9@ipinc.com>
  References: <20000906172126.A4216@s2.enthdimension.com.au> <39B68922.320969E9@ipinc.com>

* 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