Search Postgresql Archives

Re: When to use cascading deletes?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: http://solumslekt.org/blog/

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux