@@ -690,10 +690,11 @@ get_op_btree_interpretation(Oid opno)
690690 * semantics.
691691 *
692692 * This is trivially true if they are the same operator. Otherwise,
693- * we look to see if they can be found in the same btree or hash opfamily.
694- * Either finding allows us to assume that they have compatible notions
695- * of equality. (The reason we need to do these pushups is that one might
696- * be a cross-type operator; for instance int24eq vs int4eq.)
693+ * Otherwise, we look to see if they both belong to an opfamily that
694+ * guarantees compatible semantics for equality. Either finding allows us to
695+ * assume that they have compatible notions of equality. (The reason we need
696+ * to do these pushups is that one might be a cross-type operator; for
697+ * instance int24eq vs int4eq.)
697698 */
698699bool
699700equality_ops_are_compatible (Oid opno1 , Oid opno2 )
@@ -718,7 +719,7 @@ equality_ops_are_compatible(Oid opno1, Oid opno2)
718719 Form_pg_amop op_form = (Form_pg_amop ) GETSTRUCT (op_tuple );
719720 IndexAmRoutine * amroutine = GetIndexAmRoutineByAmId (op_form -> amopmethod , false);
720721
721- if (amroutine -> amcancrosscompare )
722+ if (amroutine -> amconsistentequality )
722723 {
723724 if (op_in_opfamily (opno2 , op_form -> amopfamily ))
724725 {
@@ -738,12 +739,13 @@ equality_ops_are_compatible(Oid opno1, Oid opno2)
738739 * Return true if the two given comparison operators have compatible
739740 * semantics.
740741 *
741- * This is trivially true if they are the same operator. Otherwise,
742- * we look to see if they can be found in the same btree opfamily.
743- * For example, '<' and '>=' ops match if they belong to the same family.
742+ * This is trivially true if they are the same operator. Otherwise, we look
743+ * to see if they both belong to an opfamily that guarantees compatible
744+ * semantics for ordering. (For example, for btree, '<' and '>=' ops match if
745+ * they belong to the same family.)
744746 *
745- * (This is identical to equality_ops_are_compatible(), except that we
746- * don't bother to examine hash opclasses .)
747+ * (This is identical to equality_ops_are_compatible(), except that we check
748+ * amcanorder plus amconsistentordering instead of amconsistentequality .)
747749 */
748750bool
749751comparison_ops_are_compatible (Oid opno1 , Oid opno2 )
@@ -768,7 +770,7 @@ comparison_ops_are_compatible(Oid opno1, Oid opno2)
768770 Form_pg_amop op_form = (Form_pg_amop ) GETSTRUCT (op_tuple );
769771 IndexAmRoutine * amroutine = GetIndexAmRoutineByAmId (op_form -> amopmethod , false);
770772
771- if (amroutine -> amcanorder && amroutine -> amcancrosscompare )
773+ if (amroutine -> amcanorder && amroutine -> amconsistentordering )
772774 {
773775 if (op_in_opfamily (opno2 , op_form -> amopfamily ))
774776 {
0 commit comments