From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: ATTACH PARTITION: Don't match a PK with a UNIQUE constraint
Date: Mon, 15 Apr 2024 13:08:44 +0000
Message-ID: <E1rwM4h-0029qR-PS@gemulon.postgresql.org> (raw)
ATTACH PARTITION: Don't match a PK with a UNIQUE constraint
When matching constraints in AttachPartitionEnsureIndexes() we weren't
testing the constraint type, which could make a UNIQUE key lacking a
not-null constraint incorrectly satisfy a primary key requirement. Fix
this by testing that the constraint types match. (Other possible
mismatches are verified by comparing index properties.)
Discussion: https://postgr.es/m/202402051447.wimb4xmtiiyb@alvherre.pgsql
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/cee8db3f680b737b64d747530b48d30828cf4790
Modified Files
--------------
src/backend/commands/tablecmds.c | 5 +++++
src/backend/utils/cache/lsyscache.c | 22 ++++++++++++++++++++++
src/include/utils/lsyscache.h | 2 ++
src/test/regress/expected/constraints.out | 16 ++++++++++++++++
src/test/regress/sql/constraints.sql | 7 +++++++
5 files changed, 52 insertions(+)
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: ATTACH PARTITION: Don't match a PK with a UNIQUE constraint
In-Reply-To: <E1rwM4h-0029qR-PS@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