pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Kazimiers <tom@voodoo-arts.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-general@postgresql.org
Subject: Re: Updating PK and all FKs to it in CTE
Date: Thu, 29 Jul 2021 17:12:48 +0200
Message-ID: <YQLFcA/olznkDF/4@dewberry.localdomain> (raw)
In-Reply-To: <713691.1627570269@sss.pgh.pa.us>
References: <YQKef3h1sWgnvnx+@dewberry.localdomain>
	<713691.1627570269@sss.pgh.pa.us>

On Thu, Jul 29, 2021 at 10:51:09AM -0400, Tom Lane wrote:
>I tried to reproduce your problem and failed; the attached script
>acts as I'd expect.  So there must be some moving part you've not
>mentioned.  Can yo create a similar self-contained example that
>fails?

Thanks very much for trying this. I failed to create a self-contained 
example and just now realized what the problem is: a trigger function 
accidentally created an entry with the old ID (changing the primary key 
was not anticipated until now), throwing off the constraint check. I 
noticed when running this explicitly in a transaction and then 
inspecting the table that triggered the error and also got the same 
error with ON UPDATE CASCADE. My apologies, it just took a while for me 
to realize where this entry came from and that it was not the CTE or ON 
UPDATE CASCADE causing this. It's all resolved now and I am glad the CTE 
behaves as expected.

Kind regards,
Tom





view thread (3+ messages)

Message-ID: <YQLFcA/olznkDF/4@dewberry.localdomain>
Permalink:  ../YQLFcA%2FolznkDF%2F4@dewberry.localdomain/
Also on:    postgresql.org/message-id/YQLFcA/olznkDF/4@dewberry.localdomain

 · 

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: tom@voodoo-arts.net, tgl@sss.pgh.pa.us
  Subject: Re: Updating PK and all FKs to it in CTE
  In-Reply-To: <YQLFcA/olznkDF/4@dewberry.localdomain>
  References: <YQKef3h1sWgnvnx+@dewberry.localdomain> <713691.1627570269@sss.pgh.pa.us> <YQLFcA/olznkDF/4@dewberry.localdomain>

* 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