Re: When to use cascading deletes?

From: "Leif B(dot) Kristensen" <leif(at)solumslekt(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: When to use cascading deletes?
Date: 2009-06-11 22:31:12
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Thursday 11. June 2009, David wrote:

>When is a good time to use cascading deletes?

As a real world example, I've got a data model that consists of three
major entities: Persons, Events, and Sources. The Events table is
linked to Persons through the junction table Participants, and to the
Sources through the junction table Citations. In both the Participants
and the Citations tables I have declared the foreign key events_fk as
ON DELETE CASCADE. That is because they don't carry extra information
that is usable outside the context of the Event to which they are
pointing. So, if I delete an Event, the Participants as well as the
Citations to that event are hosed. But the Persons and the Sources will
of course remain in the database.
Leif Biberg Kristensen | Registered Linux User #338009
Me And My Database:

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Leif B. Kristensen 2009-06-11 22:47:26 Re: search for partial dates
Previous Message Greg Smith 2009-06-11 22:12:06 Re: listing relations