Skip site navigation (1) Skip section navigation (2)

Re: Deferred uniqueness versus foreign keys

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)googlemail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Deferred uniqueness versus foreign keys
Date: 2009-07-28 21:10:54
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
2009/7/28 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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
> occur till after an FK check does.  Discuss.
>                        regards, tom lane

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
columns shall indicate that the unique constraint is not deferrable."

which seems like a sensible policy now that I think about it.

 - Dean

In response to


pgsql-hackers by date

Next:From: Martijn van OosterhoutDate: 2009-07-28 21:11:13
Subject: Re: plpgsql: support identif%TYPE[], (from ToDo)
Previous:From: Euler Taveira de OliveiraDate: 2009-07-28 21:08:15
Subject: Re: WIP: to_char, support for EEEE format

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group