]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Check collation when creating partitioned index
authorPeter Eisentraut <peter@eisentraut.org>
Fri, 1 Dec 2023 14:48:06 +0000 (15:48 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Fri, 1 Dec 2023 15:09:54 +0000 (16:09 +0100)
commit267f33f684173296897a5157e760c5fb7009964d
tree5a472e1c3640f3fa8fedcb2861cf6b1901a060dc
parent1dac2dd6779a7a5b35bd222f74bee1fe8c6e560d
Check collation when creating partitioned index

When creating a partitioned index, the partition key must be a subset
of the index's columns.  But this currently doesn't check that the
collations between the partition key and the index definition match.
So you can construct a unique index that fails to enforce uniqueness.
(This would most likely involve a nondeterministic collation, so it
would have to be crafted explicitly and is not something that would
just happen by accident.)

This patch adds the required collation check.  As a result, any
previously allowed unique index that has a collation mismatch would no
longer be allowed to be created.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/3327cb54-f7f1-413b-8fdb-7a9dceebb938%40eisentraut.org
src/backend/commands/indexcmds.c