ATTACH PARTITION: Don't match a PK with a UNIQUE constraint

Alvaro Herrera <alvherre@alvh.no-ip.org>

Commit: cee8db3f680b737b64d747530b48d30828cf4790
Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: 2024-04-15T13:07:47Z
Releases: 17.0
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

Discussion