From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: ATTACH PARTITION: Don't match a PK with a UNIQUE constraint |
Date: | 2024-04-15 13:08:44 |
Message-ID: | E1rwM4h-0029qR-PS@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
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(+)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2024-04-15 16:57:09 | pgsql: Fix type-checking of RECORD-returning functions in FROM, redux. |
Previous Message | Alexander Korotkov | 2024-04-15 13:06:14 | pgsql: Grammar fixes for split/merge partitions code |