Re: ALTER TABLE .... make constraint DEFERRABLE

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: ALTER TABLE .... make constraint DEFERRABLE
Date: 2010-06-03 08:33:01
Message-ID: AANLkTinn3h-IKeHGX2ddnGkymN-F1JLU_63PvAb2Yj9l@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 3 June 2010 02:06, Bruce Momjian <bruce(at)momjian(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message KaiGai Kohei 2010-06-03 08:45:10 [PATCH] Fix leaky VIEWs for RLS
Previous Message Simon Riggs 2010-06-03 07:56:54 Re: Keepalive for max_standby_delay