Quote:
Originally posted by neiljchen
Dear,
According to your ASSERTION method, how about InsuranceCard has foreign key reference to Customer. If I use assertion method, will that cause i can never insert a new customer?
neil
|
I'm not so clear on the ASSERTION method, because I have never had the opportunity to use it. Like all the other methods, the assertion constraint would need to be deferrable until COMMIT, because it is obviously violated otherwise (assuming Customer inserted first). So the sequence of events would be:
1) insert Customer (assertion would fail, but is not checked as it is "deferred")
2) insert InsuranceCard (foreign key constraint validated)
3) commit (deferred assertion is now checked and succeeds)
Alternatively, the foreign key could be deferred and the assertion immediate, in which case the sequence would be:
1) insert InsuranceCard (foreign key would fail, but is not checked as it is "deferred")
2) insert Customer (assertion validated)
3) commit (deferred foreign key is now checked and succeeds)