Re: delete cascade

From: Bob Badour <bbadour_at_pei.sympatico.ca>
Date: Sun, 22 Apr 2007 12:47:35 GMT
Message-ID: <HPIWh.26898$PV3.278671_at_ursa-nb00s0.nbnet.nb.ca>


paul c wrote:
> paul c wrote:
>

>> Bob Badour wrote:
>>
>>> ...
>>> More and more, I am liking "on delete" or "on update" less and less. 
>>> I suggest the appropriate place to handle the issue is in the view 
>>> specification. If one wants "on delete cascase", one can present a 
>>> view with the invoice items as an RVA.
>>> ...
>>
>> That is intriguing about RVA's.  Do you have in mind entwining the 
>> notion of an invoice transaction with a reference constraint by not 
>> assigning the rva until it is known (by some program) that all items 
>> have been inserted (into some table or other)?

>
> Eg., the rva has an attribute that references the invoice# in the same
> relation that has the rva as an attribute.
>
> p

Consider base relations you would likely find familiar with an Invoice relation, an InvoiceItem relation, and a foreign key reference from InvoiceItem to Invoice.

In the first case, consider application views that essentially mirror the base relations. If someone tries to delete an invoice while invoice items remain, the dbms will balk with an error due to the foreign key constraint.

In a second case, consider an application view that groups the invoice items as an RVA of each invoice. If one deletes an invoice, one deletes the invoice items at the same time and the dbms will not balk.

In a third case, consider an application view that exposes only the invoice and not the items: The "on delete cascade" trigger would allow one to delete the invoice and the invoice items without ever knowing about the items. Can one devise a view that would achieve the same effect?

Would it suffice to declare the view using the RVA as above and then project away the RVA? Received on Sun Apr 22 2007 - 14:47:35 CEST

Original text of this message