Re: [GENERAL] When to use cascading deletes?

2009-06-11 Thread Leif B. Kristensen
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 S

Re: [GENERAL] When to use cascading deletes?

2009-06-11 Thread Russ Brown
On 06/11/2009 11:33 AM, Eric Schwarzenbach wrote: My rule of thumb for when to use to not use cascading deletes is this: If the what the record represents can essentially be thought of a "part of" what the record that it references represents, I use cascading deletes. If what the record represen

Re: [GENERAL] When to use cascading deletes?

2009-06-11 Thread Eric Schwarzenbach
My rule of thumb for when to use to not use cascading deletes is this: If the what the record represents can essentially be thought of a "part of" what the record that it references represents, I use cascading deletes. If what the record represents has an independent existence, that it, it does no

Re: [GENERAL] When to use cascading deletes?

2009-06-11 Thread Richard Broersma
On Thu, Jun 11, 2009 at 4:44 AM, Greg Stark wrote: > I generally leave cascade off except for many-to-many mapping tables > which contain no additional data and are a pain to manage. Which does > sound similar to Alban's rule of thumb. Cascading deletes also make sense for vertically partitioned

Re: [GENERAL] When to use cascading deletes?

2009-06-11 Thread Greg Stark
On Thu, Jun 11, 2009 at 9:59 AM, David wrote: > > Ideally, I'd like postgresql to not do cascading deletes, *except* > when I tell it to, and the rest of the time fail when the user didn't > explicitly "opt in" for cascading deletes. When it comes to enabling > cascading deletes, I don't really lik

Re: [GENERAL] When to use cascading deletes?

2009-06-11 Thread Sim Zacks
I use cascading deletes as per business rule. For example, my customer record has multiple orders and each order can have multiple shipments and multiple payments. My business rule is not to erase a customer with orders, but orders should be erased even if they have shipments or payments. The bus

Re: [GENERAL] When to use cascading deletes?

2009-06-11 Thread Steve Clark
David wrote: Thanks for the tips, those make sense. I was thinking through this some more after sending my mail, and came to similar conclusions. It would be nice though if this info was more available to people doing research on the subject. Where did you pick up these ideas? At least this thr

Re: [GENERAL] When to use cascading deletes?

2009-06-11 Thread David
Thanks for the tips, those make sense. I was thinking through this some more after sending my mail, and came to similar conclusions. It would be nice though if this info was more available to people doing research on the subject. Where did you pick up these ideas? At least this thread should star

Re: [GENERAL] When to use cascading deletes?

2009-06-11 Thread Alban Hertroys
On Jun 11, 2009, at 10:59 AM, David wrote: Hi there. When is a good time to use cascading deletes? As a general rule of thumb I use cascading deletes if the data in a record is meaningless without the record that the foreign key points to. Ideally, I'd like postgresql to not do cascading

[GENERAL] When to use cascading deletes?

2009-06-11 Thread David
Hi there. When is a good time to use cascading deletes? Usually, for safety reasons, I prefer to not ever use cascading deletes. But that can lead to some complex code that uses topological sorts etc to manually delete records in the right order, when a cascading delete is needed. Ideally, I'd l