]> granicus.if.org Git - postgresql/commit
Improve conversion of legacy CREATE CONSTRAINT TRIGGER representation of
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 5 Nov 2007 19:00:25 +0000 (19:00 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 5 Nov 2007 19:00:25 +0000 (19:00 +0000)
commitdf870740928d82c4ba9edcc1358fae74e5495359
tree1241c979902c965ae802c0e5951de8d561affab3
parentc1a03bee0806c14511bf94d257e3e41bcaf2a78a
Improve conversion of legacy CREATE CONSTRAINT TRIGGER representation of
foreign keys, one more time.  Insist on matching up all three triggers before
we create a constraint; this will avoid creation of duplicate constraints
in scenarios where a broken FK constraint was repaired by re-adding the
constraint without removing the old partial trigger set.  Basically, this will
work nicely in all cases where the FK was actually functioning correctly in
the database that was dumped.  It will fail to restore an FK in just one case
where we theoretically could restore it: where we find the referenced table's
triggers and not the referencing table's trigger.  However, in such a scenario
it's likely that the user doesn't even realize he still has an FK at all
(since the more-likely-to-fail cases aren't enforced), and we'd probably not
accomplish much except to cause the reload to fail because the data doesn't
meet the FK constraint.  Also make the NOTICE logging still more verbose, by
adding detail about which of the triggers were found.  This seems about all
we can do without solving the problem of getting the user's attention at
session end.
src/backend/commands/trigger.c