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: pgsql-hackers@postgresql.org
Date: 2010-12-12T23:08:43Z
Lists: pgsql-hackers
On Sun, 2010-12-12 at 17:57 -0500, Tom Lane wrote: > Simon Riggs <simon@2ndQuadrant.com> writes: > > The new SQL Standard (SQL:2011) contains this: > > "Table constraints are either enforced or not enforced. Domain > > constraints and assertions are always enforced.", 4.17.2 > > > The SQL Standard allows you to turn the checking on and off for CHECK > > constraints, UNIQUE constraints and FOREIGN KEYS. > > Huh? It allows you to postpone the check until commit. That's far from > not enforcing it. "When a <commit statement> is executed, all enforced constraints are effectively checked and, if any enforced constraint is not satisfied, then an exception condition is raised and the SQL-transaction is terminated by an implicit <rollback statement>." This clearly implies that un-enforced constraints are not checked at commit. -- Simon Riggs http://www.2ndQuadrant.com/books/ PostgreSQL Development, 24x7 Support, Training and Services