Re: ALTER TABLE .... make constraint DEFERRABLE - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: ALTER TABLE .... make constraint DEFERRABLE
Date
Msg-id AANLkTinn3h-IKeHGX2ddnGkymN-F1JLU_63PvAb2Yj9l@mail.gmail.com
Whole thread Raw
In response to Re: ALTER TABLE .... make constraint DEFERRABLE  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
On 3 June 2010 02:06, Bruce Momjian <bruce@momjian.us> wrote:
>> Also, foreign keys can't be defined that refer to a deferrable primary
>> key. That isn't mentioned at all in the manual with regard to the
>> DEFERRABLE clause, though it is mentioned in the FK section. You get
>> this error message
>> ERROR:  cannot use a deferrable unique constraint for referenced table
>>
>> The use case for this feature looks a little narrow at present. Can we
>> do something about usability?
>
> Not sure why that was a limitation.
>

That's in accordance with the SQL spec.

I didn't think of this case originally, but all sorts of complications
would arise if we were to allow FKs to refer to deferrable PKs. For
example, if there are 2 temporarily duplicated PKs, and you update one
of them, what would the FK's ON UPDATE actions do? I'm not convinced
there is any sensible answer to this question.

Regards,
Dean


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Keepalive for max_standby_delay
Next
From: KaiGai Kohei
Date:
Subject: [PATCH] Fix leaky VIEWs for RLS