Re: PostgreSQL 15.9 Update: Partitioned tables with foreign key constraints - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: PostgreSQL 15.9 Update: Partitioned tables with foreign key constraints
Date
Msg-id 202411191634.vexoqghfj2aq@alvherre.pgsql
Whole thread Raw
In response to PostgreSQL 15.9 Update: Partitioned tables with foreign key constraints  (Paul Foerster <paul.foerster@gmail.com>)
Responses Re: PostgreSQL 15.9 Update: Partitioned tables with foreign key constraints
List pgsql-general
Hi Paul,

On 2024-Nov-19, Paul Foerster wrote:

> the PostgreSQL 15.9 release notes instruct to look out for especially
> detached partitions with foreign key constraints. I'm in the process
> of updating our databases from 15.8 to 15.9 now and found a case where
> the select statement returns a constraint.
> 
> The release notes say nothing about when to fix that using the
> generated add or drop statements.
> 
> Do I want/need to do that before or after I exchange the software? And
> if it is to be done on a particular of the two releases, why is that?

It doesn't really matter when you do it, because the constraint only
gets broken by running DETACH with the old server code.  You have
already run the DETACH sometime in the past (that's how the constraint
got broken), which means you would not run it again now to the same
table.  The old server code will behave correctly when doing ADD / DROP
constraint, as will the new server code.  Feel free to run it when it's
more convenient to you.

I'd advise against running ALTER TABLE DETACH until you have upgraded,
however -- at least, for partitioned tables that have foreign keys
pointing to other partitioned tables.

Thanks,

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/
"Postgres is bloatware by design: it was built to house
 PhD theses." (Joey Hellerstein, SIGMOD annual conference 2002)



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Re : Credcheck extension
Next
From: Laurenz Albe
Date:
Subject: Re: Functions and Indexes