Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED
Date
Msg-id 1292195323.2737.2335.camel@ebony
Whole thread Raw
In response to Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED
Next
From: Tom Lane
Date:
Subject: Re: create tablespace fails silently, or succeeds improperly