diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index 0b3b8e98b80..c7ecedbe3bc 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -1011,10 +1011,13 @@ 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]) + continue; + if (get_opclass_opfamily_and_input_type(opclassIds[j], &idx_opfamily, &idx_opcintype))