Re: One more time on ONE-TO-MANY

From: Dennis Gearon <gearond(at)fireserve(dot)net>
To: Duane Lee - EGOVX <DLee(at)mail(dot)maricopa(dot)gov>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: One more time on ONE-TO-MANY
Date: 2004-05-27 00:25:22
Message-ID: 40B53572.8020506@fireserve.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Yes, and No. I am talking about that capability, which is the first two
in the list, pluse another, the last one in the list.

That is when an attempt to delete the LAST CHILD takes place, the logic
is that there is no need for the parent, or that there must be a child
for every parent.
So, either the action is to say NO, error out, or the parent is deleted
along with the child.

Currently, all Postgres supports natively is what should happen if the
PARENT is deleted.

Supposedly, some RDBMs handle the options of when the LAST child is
deleted, natively, by declaration in the constraint.

Duane Lee - EGOVX wrote:

> It sounds like you are referring to a RI (Referential Integrity)
> constraint and if so one of the options when the constraint is defined
> is CASCADE DELETE, i.e., delete the children rows then delete the
> parent row and this is available in Postgres.
>
> Is this what you were asking or did I mis-interpret your query?
>
> Duane
>
> -----Original Message-----
> From: Dennis Gearon [mailto:gearond(at)fireserve(dot)net]
> Sent: Wednesday, May 26, 2004 3:25 PM
> To: pgsql-general(at)postgresql(dot)org
> Subject: [GENERAL] One more time on ONE-TO-MANY
>
>
> CC me, I'm digesting this list.
>
> From:
> http://www.sum-it.nl/cursus/dbdesign/english/intro030.php3
> A quote:
> ' In addition *the database designer chooses* an action for delete:
>
> * It's /only possible/ to delete a row in the one-table when there a
> no more related many-rows.
> * When deleting a row the RDBMS
> <http://www.sum-it.nl/cursus/dbdesign/english/intro030.php3#rdbms>
> /automatically/ deletes the related data in the many table. This
> is called a /cascaded delete/.
> * When deleting the last 'many' the RDBMS /automatically/ deletes
> the related 'one' row.'
>
> I'm pretty sure that Postgres does not support the last one
> automatically. I shall have to do that one by either a chron script or a
> post trigger.
>
> Does anyone have experience with a database that will do the last one,
> and what database would that be?
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Duane Lee - EGOVX 2004-05-27 00:51:09 Re: One more time on ONE-TO-MANY
Previous Message Duane Lee - EGOVX 2004-05-26 23:19:41 Re: One more time on ONE-TO-MANY