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

From Nicolas Barbier
Subject Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED
Date
Msg-id AANLkTi=0BR29ArB9DFGATyG0nocMwkJRgU8cBR2cZBK4@mail.gmail.com
Whole thread Raw
In response to Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
2010/12/13 Tom Lane <tgl@sss.pgh.pa.us>:

> But allow me to harbor doubts that they really
> intend to allow someone to force a constraint to be considered valid
> without any verification.

"Table constraints are either enforced or not enforced. Domain
constraints and assertions are always enforced.", 4.17.2

I don't read that as meaning that such unenforced constraints are
considered "valid". It sounds as if unenforced constraints are the
same as non-existing constraints (think: constraint "templates"),
possibly as a means to "remember" that they should be re-enabled at
some point.

I.e., marking a constraint as unenforced and then as enforced again
would be a shortcut for removing and re-adding the constraint, while
having the advantage that one doesn't have to keep a list of
constraint definitions that must be re-added.

> (In particular, can a constraint
> go from not-enforced to enforced state without getting checked at that
> time?)

I assume not.

Nicolas


pgsql-hackers by date:

Previous
From: tv@fuzzy.cz
Date:
Subject: Re: proposal : cross-column stats
Next
From: aaliya zarrin
Date:
Subject: WaitLatch