[HACKERS] Deferred uniqueness versus foreign keys

2009-07-28 Thread Tom Lane
[sigh, forgot to cc hackers the first time ] Foreign key behavior is only sane if the referenced column(s) are unique. With the proposed patch, it is possible that the uniqueness check on the referenced columns is deferred, which means it might not occur till after an FK check does. Discuss.

Re: [HACKERS] Deferred uniqueness versus foreign keys

2009-07-28 Thread Dean Rasheed
2009/7/28 Tom Lane t...@sss.pgh.pa.us: [sigh, forgot to cc hackers the first time ] Foreign key behavior is only sane if the referenced column(s) are unique.  With the proposed patch, it is possible that the uniqueness check on the referenced columns is deferred, which means it might not

Re: [HACKERS] Deferred uniqueness versus foreign keys

2009-07-28 Thread Jeff Davis
On Tue, 2009-07-28 at 22:10 +0100, Dean Rasheed wrote: Hmm, yes, looking in the SQL spec, I've just noticed this under 11.8, referential constraint definition: The table constraint descriptor describing the unique constraint definition whose unique column list identifies the referenced

Re: [HACKERS] Deferred uniqueness versus foreign keys

2009-07-28 Thread Tom Lane
Jeff Davis pg...@j-davis.com writes: Is it a problem to allow unique constraints to be deferrable until the end of the command though? Yes. If you do have a case where this matters, the command updating the referenced table is most likely different from the one updating the referencing table,