pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Deferrable FK not behaving as expected.
Date: Mon, 7 Dec 2020 12:26:26 -0600
Message-ID: <c32cafb1-60e5-f2cb-be23-05ae88ab8d10@gmail.com> (raw)
In-Reply-To: <b97cbd9d-1615-c9e1-aff1-683a37fedee9@gmx.net>
References: <75fe0761-a291-86a9-c8d8-4906da077469@gmail.com>
	<b97cbd9d-1615-c9e1-aff1-683a37fedee9@gmx.net>

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.





view thread (10+ messages)  latest in thread

Message-ID: <c32cafb1-60e5-f2cb-be23-05ae88ab8d10@gmail.com>
Permalink:  ../c32cafb1-60e5-f2cb-be23-05ae88ab8d10@gmail.com/
Also on:    postgresql.org/message-id/c32cafb1-60e5-f2cb-be23-05ae88ab8d10@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ronljohnsonjr@gmail.com
  Subject: Re: Deferrable FK not behaving as expected.
  In-Reply-To: <c32cafb1-60e5-f2cb-be23-05ae88ab8d10@gmail.com>
  References: <75fe0761-a291-86a9-c8d8-4906da077469@gmail.com> <b97cbd9d-1615-c9e1-aff1-683a37fedee9@gmx.net> <c32cafb1-60e5-f2cb-be23-05ae88ab8d10@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox