Re: Deferrable FK not behaving as expected. - Mailing list pgsql-general

From Ron
Subject Re: Deferrable FK not behaving as expected.
Date
Msg-id c32cafb1-60e5-f2cb-be23-05ae88ab8d10@gmail.com
Whole thread Raw
In response to Re: Deferrable FK not behaving as expected.  (Thomas Kellerer <shammat@gmx.net>)
List pgsql-general
On 12/7/20 12:19 PM, Thomas Kellerer wrote:
> Ron schrieb am 07.12.2020 um 19:15:
>> Referenced by:
>>      TABLE "sales_detail" CONSTRAINT "fk_sales_detail_sales_header"
>>            FOREIGN KEY (cust_id, order_ts) REFERENCES 
>> sales_header(cust_id, order_ts) *DEFERRABLE*
>
> I think if you only mention "deferrable" this is the same as "deferrable 
> initially immediate",
> so you will need to make them deferrable in your transaction:
>
>     SET CONSTRAINTS ALL DEFERRED;
>
> or create the constraint with
>
>     deferrable initially deferred

OK.  For some reason, I thought INITIALLY DEFERRED was only applicable to 
INSERT and UPDATE statements.

-- 
Angular momentum makes the world go 'round.



pgsql-general by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: Deferrable FK not behaving as expected.
Next
From: Ron
Date:
Subject: Re: Deferrable FK not behaving as expected.