Databases Reference
In-Depth Information
CONSTRAINT ... UNION { NLS , NPS } KEY { SNO } ;
Of course, this constraint will be enforced automatically if relvars NLS and NPS are in fact
views of the suppliers relvar S.
Here now are the compensatory actions—first, the usual rules for cascading updates from
NLS to NPS and vice versa:
ON INSERT i INTO NLS : INSERT ( i WHERE CITY 'Paris' ) INTO NPS ;
ON INSERT i INTO NPS : INSERT ( i WHERE CITY 'London' ) INTO NLS ;
ON DELETE d FROM NLS : DELETE ( d WHERE CITY 'Paris' ) FROM NPS ;
ON DELETE d FROM NPS : DELETE ( d WHERE CITY 'London' ) FROM NLS ;
Next, here's the rule for cascading inserts on NLS to DLP:
ON INSERT i INTO NLS : INSERT ( i WHERE CITY = 'Paris' ) INTO DLP ;
And the rule for cascading deletes on NLS to DLP:
ON DELETE d FROM NLS : DELETE ( d WHERE CITY = 'Paris' ) FROM DLP ;
(We could drop the restriction condition here without loss.)
As for inserts on NPS, the analysis in previous sections should lead you to expect
something like the following:
ON INSERT i INTO NPS : DELETE i FROM DLP ;
But if tuple t is to be inserted into NPS, then tuple t must have CITY value something other than
Paris—and since tuples in DLP all have CITY value Paris, the compensatory action here
becomes a “no op.”
Finally, what about deletes on NPS? Again, the analysis in previous sections should lead
you to expect something like the following:
ON DELETE d FROM NPS : INSERT ( d INTERSECT NLS ) INTO DLP ;
But tuples in NPS all have CITY value something other than Paris; hence, so do all tuples in d ,
and so do all tuples in d INTERSECT NLS a fortiori. 7 And since tuples in DLP all have CITY
value Paris, the compensatory action here becomes a “no op” again. Note: Actually, taking
these two “no op” rules together, it should be intuitively obvious that—speaking pretty loosely,
of course—inserts and deletes on NPS (= non Paris suppliers) can't possibly have any effect on
DLP (= Paris suppliers).
7 Again recall our assumption from Chapter 4, according to which every tuple in d also appears in NPS.
Search WWH ::




Custom Search