ATTACH PARTITION: Don't match a PK with a UNIQUE constraint
Alvaro Herrera <alvherre@alvh.no-ip.org>
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
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/commands/tablecmds.c | modified | +5 −0 |
| src/backend/utils/cache/lsyscache.c | modified | +22 −0 |
| src/include/utils/lsyscache.h | modified | +2 −0 |
| src/test/regress/expected/constraints.out | modified | +16 −0 |
| src/test/regress/sql/constraints.sql | modified | +7 −0 |
Discussion
- cataloguing NOT NULL constraints 163 messages · 2022-08-17 → 2024-05-16