diff options
| author | Alvaro Herrera | 2024-04-15 13:07:47 +0000 |
|---|---|---|
| committer | Alvaro Herrera | 2024-04-15 13:07:47 +0000 |
| commit | cee8db3f680b737b64d747530b48d30828cf4790 (patch) | |
| tree | f45fbe7ffe98414d9e4e4b8348597f3bff73ca38 /src/include | |
| parent | 9dfcac8e15acc3b4d4d5bc02383a56ccb07229fe (diff) | |
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
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/utils/lsyscache.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h index 35a8dec2b9f..20446f6f836 100644 --- a/src/include/utils/lsyscache.h +++ b/src/include/utils/lsyscache.h @@ -100,6 +100,8 @@ extern char *get_collation_name(Oid colloid); extern bool get_collation_isdeterministic(Oid colloid); extern char *get_constraint_name(Oid conoid); extern Oid get_constraint_index(Oid conoid); +extern char get_constraint_type(Oid conoid); + extern char *get_language_name(Oid langoid, bool missing_ok); extern Oid get_opclass_family(Oid opclass); extern Oid get_opclass_input_type(Oid opclass); |
