pgsql: Check collation when creating partitioned index

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Check collation when creating partitioned index
Date: 2023-12-01 15:31:52
Message-ID: E1r95Ue-0087vP-5T@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://www.postgresql.org/message-id/flat/3327cb54-f7f1-413b-8fdb-7a9dceebb938%40eisentraut.org

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e846fc491923a499a6d8b388292798fc808cd7a3

Modified Files
--------------
src/backend/commands/indexcmds.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2023-12-01 16:59:04 pgsql: pgindent fix
Previous Message Andrew Dunstan 2023-12-01 14:04:19 Re: pgsql: meson: docs: Add {html,man} targets, rename install-doc-*