Databases Reference
In-Depth Information
be a “no op” and inserts on that join would always fail (unless they're “no ops” as well). As for
the second possibility, I suppose it could be argued that this is a case where an option 1 or option
2 delete rule might make sense. Well, maybe; I don't find the argument very convincing myself;
but I suppose I could be persuaded otherwise if it could be shown there was a really strong
requirement here. For the time being, however, I propose to stay with my “one size fits all” rule
as described earlier in the chapter (which does of course still work, even in the rather special case
under discussion here).
My other point has to do with the fact that—as is of course well known—intersection is a
special case of one to one join. 10 It follows that the rules for updating through a one to one join
apply to intersection as well (more precisely, they reduce to the rules for updating through an
intersection, in the special case where the join itself reduces to an intersection). To spell those
rules out (albeit in simplified form), 11 let V be defined as A INTERSECT B . Then we have:
ON INSERT i INTO A :
INSERT ( i INTERSECT B ) INTO V ;
ON INSERT i INTO B :
INSERT ( i INTERSECT A ) INTO V ;
ON DELETE d FROM A :
DELETE d FROM V ;
ON DELETE d FROM B :
DELETE d FROM V ;
ON INSERT i INTO V :
INSERT i INTO A ,
INSERT i INTO B ;
ON DELETE d FROM V :
DELETE d FROM A ,
DELETE d FROM B ;
Now, I'll have a lot more to say about intersection as such in Chapter 9, but I wanted to
mention it here because it allows me to spell out what earlier in this chapter I referred to as “the
classic ambiguity issue” in logical terms. As I've said, the rule for deleting through a one to one
join, in the case where the term “one to one” is being used only loosely (as in Example 2), does
involve a certain degree of pragma. Well, now I can pin down exactly what that pragma consists
of. Recall from Chapter 2 that every relvar, and more generally every relational expression, has
an associated predicate (in the latter case, the predicate is derived from the predicates for the
relvars involved in the expression, in accordance with the semantics of the relational operations
involved in that expression). So let the predicates for A and B be PA and PB , respectively; then
10 Strict or otherwise—though in fact “strict” makes little sense here (why?).
11 I'll refine these rules slightly in Chapter 9.
Search WWH ::




Custom Search