From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Choose FK name correctly during partition attachment
Date: Thu, 08 Sep 2022 11:19:58 +0000
Message-ID: <E1oWFZd-001zTe-LI@gemulon.postgresql.org> (raw)
Choose FK name correctly during partition attachment
During ALTER TABLE ATTACH PARTITION, if the name of a parent's foreign
key constraint is already used on the partition, the code tries to
choose another one before the FK attributes list has been populated,
so the resulting constraint name was "<relname>__fkey" instead of
"<relname>_<attrs>_fkey". Repair, and add a test case.
Backpatch to 12. In 11, the code to attach a partition was not smart
enough to cope with conflicting constraint names, so the problem doesn't
exist there.
Author: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>
Discussion: https://postgr.es/m/20220901184156.738ebee5@karst
Branch
------
REL_15_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/ade2409b18e9c5d68afb13831da69198d06e5062
Modified Files
--------------
src/backend/commands/tablecmds.c | 20 ++++++++++----------
src/test/regress/expected/constraints.out | 23 +++++++++++++++++++++++
src/test/regress/sql/constraints.sql | 19 +++++++++++++++++++
3 files changed, 52 insertions(+), 10 deletions(-)
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 using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: alvherre@alvh.no-ip.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Choose FK name correctly during partition attachment
In-Reply-To: <E1oWFZd-001zTe-LI@gemulon.postgresql.org>
* 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