Re: delete cascade

From: David BL <davidbl_at_iinet.net.au>
Date: 23 Apr 2007 23:19:39 -0700
Message-ID: <1177395579.024324.288550_at_n35g2000prd.googlegroups.com>


On Apr 24, 6:28 am, paul c <toledobythe..._at_oohay.ac> wrote:
> Bob Badour wrote:
> > paul c wrote:
>
> >> Bob Badour wrote:
>
> >>> paul c wrote:
>
> >> ...
>
> >>>>> I mention it because it would fully disclose the data to be
> >>>>> deleted, which is the invoice and the associated items.
>
> >>>> I can see that it would fully enclose, ie., enclose in one relation,
> >>>> but not sure how it would disclose any more fully than two
> >>>> selections and a join.
>
> >>>> Not trying to be picky but I found your view suggestion to be
> >>>> profound and want to make sure I understand this one.
>
> >>> I didn't refer to two selects and a join so I find your comment
> >>> confusing. I was discussing a single delete that deletes both just as
> >>> an "on delete cascade" trigger would delete both.
>
> >> I had an example like this in mind:
>
> >> V = (invoices where invoice# = 99) <AND> (items where invoice# = 99);
> >> DELETE V;
>
> > That's still a compound delete where someone spells out the delete, or
> > are you suggesting that V is a pre-existing view?
>
> > If pre-existing, I would think the following more likely:
>
> > V = (invoices <AND> items);
> > DELETE V where invoice# = 99;
>
> > But the above has the problem that only invoices with items will appear
> > in the view, which is why I suggested an RVA.
>
> Bulls-eye! Thanks, now I get it.

Keeping in mind that a view is a set of relations, consider a view that exposes the invoices relation but not the items relation. There is no join being used to construct the view so invoices without items will appear in the view. Assuming we follow the rule that a view works identically to a set of base relations, then when an invoice is deleted it must implicitly delete all the items as well. Received on Tue Apr 24 2007 - 08:19:39 CEST

Original text of this message