Re: delete cascade
From: paul c <toledobythesea_at_oohay.ac>
Date: Tue, 17 Apr 2007 13:13:17 GMT
Message-ID: <NJ3Vh.87967$aG1.19201_at_pd7urf3no>
>
>
> To bring this back to where it started, you suggested that all foreign
> key references could cascade deletes. However, consider what would
> happen if one had a reference to a relation describing allowed statuses
> or geopolitical boundaries.
>
> Before one deletes the 'Pending' status, one would want to make sure no
> invoices are pending. Deleting thousands of pending invoices would be a
> mistake.
> ...
Date: Tue, 17 Apr 2007 13:13:17 GMT
Message-ID: <NJ3Vh.87967$aG1.19201_at_pd7urf3no>
Bob Badour wrote:
> paul c wrote:
>
>> paul c wrote: >> >>> Bob Badour wrote: >> >> >> ... >> >>>> No. One states that deleting the invoice automatically deletes any >>>> items that exist. The other states that one may not delete an >>>> invoice when any items exist. >>> >>> >>> Thanks, that clears up my confusion. Still, it strikes me as more an >>> attitude than a logical interpretation. If I could, I'd rather >>> wonder how to declare a reference from the logical complement of >>> invoices to the complement of items! >> >> >> Sorry, I think I put that wrongly. Maybe the constraint that "one may >> not delete an invoice when any items exists would look something like >> "(NOT Invoices{Invoice#}) AND Items{Invoice#} = FALSE", ie., a >> reference from the complement of invoices to items.
>
>
> To bring this back to where it started, you suggested that all foreign
> key references could cascade deletes. However, consider what would
> happen if one had a reference to a relation describing allowed statuses
> or geopolitical boundaries.
>
> Before one deletes the 'Pending' status, one would want to make sure no
> invoices are pending. Deleting thousands of pending invoices would be a
> mistake.
> ...
No argument. But I would think a constraint that involved status would be a more specific way to prevent that mistake and I would like that because it might express the biz rule precisely. (Not that I know the best way to express such a constraint.)
p Received on Tue Apr 17 2007 - 15:13:17 CEST