diff options
Diffstat (limited to 'src/backend/utils/cache/lsyscache.c')
-rw-r--r-- | src/backend/utils/cache/lsyscache.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index 7bd476f3de7..97ad36a031b 100644 --- a/src/backend/utils/cache/lsyscache.c +++ b/src/backend/utils/cache/lsyscache.c @@ -690,10 +690,11 @@ get_op_btree_interpretation(Oid opno) * semantics. * * This is trivially true if they are the same operator. Otherwise, - * we look to see if they can be found in the same btree or hash opfamily. - * Either finding allows us to assume that they have compatible notions - * of equality. (The reason we need to do these pushups is that one might - * be a cross-type operator; for instance int24eq vs int4eq.) + * Otherwise, we look to see if they both belong to an opfamily that + * guarantees compatible semantics for equality. Either finding allows us to + * assume that they have compatible notions of equality. (The reason we need + * to do these pushups is that one might be a cross-type operator; for + * instance int24eq vs int4eq.) */ bool equality_ops_are_compatible(Oid opno1, Oid opno2) @@ -718,7 +719,7 @@ equality_ops_are_compatible(Oid opno1, Oid opno2) Form_pg_amop op_form = (Form_pg_amop) GETSTRUCT(op_tuple); IndexAmRoutine *amroutine = GetIndexAmRoutineByAmId(op_form->amopmethod, false); - if (amroutine->amcancrosscompare) + if (amroutine->amconsistentequality) { if (op_in_opfamily(opno2, op_form->amopfamily)) { @@ -738,12 +739,13 @@ equality_ops_are_compatible(Oid opno1, Oid opno2) * Return true if the two given comparison operators have compatible * semantics. * - * This is trivially true if they are the same operator. Otherwise, - * we look to see if they can be found in the same btree opfamily. - * For example, '<' and '>=' ops match if they belong to the same family. + * This is trivially true if they are the same operator. Otherwise, we look + * to see if they both belong to an opfamily that guarantees compatible + * semantics for ordering. (For example, for btree, '<' and '>=' ops match if + * they belong to the same family.) * - * (This is identical to equality_ops_are_compatible(), except that we - * don't bother to examine hash opclasses.) + * (This is identical to equality_ops_are_compatible(), except that we check + * amcanorder plus amconsistentordering instead of amconsistentequality.) */ bool comparison_ops_are_compatible(Oid opno1, Oid opno2) @@ -768,7 +770,7 @@ comparison_ops_are_compatible(Oid opno1, Oid opno2) Form_pg_amop op_form = (Form_pg_amop) GETSTRUCT(op_tuple); IndexAmRoutine *amroutine = GetIndexAmRoutineByAmId(op_form->amopmethod, false); - if (amroutine->amcanorder && amroutine->amcancrosscompare) + if (amroutine->amcanorder && amroutine->amconsistentordering) { if (op_in_opfamily(opno2, op_form->amopfamily)) { |