0001-Check-collation-when-creating-partitioned-index.patch
text/plain
Filename: 0001-Check-collation-when-creating-partitioned-index.patch
Type: text/plain
Part: 0
Patch
Format: format-patch
Series: patch 0001
Subject: Check collation when creating partitioned index
| File | + | − |
|---|---|---|
| src/backend/commands/indexcmds.c | 11 | 1 |
From 3acd59dcd7dffcfd22e61cce3ac1bb4c6982d16d Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Mon, 13 Nov 2023 10:15:23 +0100
Subject: [PATCH] Check collation when creating partitioned index
---
src/backend/commands/indexcmds.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index c160d8a301..729f200395 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -1011,10 +1011,20 @@ DefineIndex(Oid tableId,
{
if (key->partattrs[i] == indexInfo->ii_IndexAttrNumbers[j])
{
- /* Matched the column, now what about the equality op? */
+ /* Matched the column, now what about the collation and equality op? */
Oid idx_opfamily;
Oid idx_opcintype;
+ if (key->partcollation[i] != collationIds[j])
+ {
+ Form_pg_attribute att = TupleDescAttr(RelationGetDescr(rel), key->partattrs[i] - 1);
+
+ ereport(ERROR,
+ errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("collation of column \"%s\" does not match between partition key and index definition",
+ NameStr(att->attname)));
+ }
+
if (get_opclass_opfamily_and_input_type(opclassIds[j],
&idx_opfamily,
&idx_opcintype))
--
2.42.1