During ALTER TABLE ADD FOREIGN KEY, try to check the existing rows using

Tom Lane <tgl@sss.pgh.pa.us>

Commit: fec58f6c3f17ba6acbba65a73ca736578041677f
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2003-10-06T16:38:28Z
Releases: 7.4.1
During ALTER TABLE ADD FOREIGN KEY, try to check the existing rows using
a single LEFT JOIN query instead of firing the check trigger for each
row individually.  Stephan Szabo, with some kibitzing from Tom Lane and
Jan Wieck.

Files