Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED

Simon Riggs <simon@2ndquadrant.com>

From: Simon Riggs <simon@2ndQuadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Chris Browne <cbbrowne@acm.org>, pgsql-hackers@postgresql.org
Date: 2011-01-23T22:10:43Z
Lists: pgsql-hackers
On Sun, 2011-01-23 at 16:13 -0500, Tom Lane wrote:
> Simon Riggs <simon@2ndQuadrant.com> writes:
> > You can add an FK without an initial check, but the FK is enforced for
> > all further DML changes.
> 
> I seem to recall pointing out upthread that the FK check triggers are
> designed on the assumption that the constraint does hold currently.
> Has any analysis been done on exactly how badly they'll fail when it
> doesn't hold?  I remain unconvinced that this behavior is desirable.

If you mean RESTRICT relationships, then yes.

I haven't foreseen other problems myself. What other ideas or risks
would you like me to confirm or deny for you? 

-- 
 Simon Riggs           http://www.2ndQuadrant.com/books/
 PostgreSQL Development, 24x7 Support, Training and Services