@@ -690,10 +690,11 @@ get_op_btree_interpretation(Oid opno)
690
690
* semantics.
691
691
*
692
692
* 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.)
697
698
*/
698
699
bool
699
700
equality_ops_are_compatible (Oid opno1 , Oid opno2 )
@@ -718,7 +719,7 @@ equality_ops_are_compatible(Oid opno1, Oid opno2)
718
719
Form_pg_amop op_form = (Form_pg_amop ) GETSTRUCT (op_tuple );
719
720
IndexAmRoutine * amroutine = GetIndexAmRoutineByAmId (op_form -> amopmethod , false);
720
721
721
- if (amroutine -> amcancrosscompare )
722
+ if (amroutine -> amconsistentequality )
722
723
{
723
724
if (op_in_opfamily (opno2 , op_form -> amopfamily ))
724
725
{
@@ -738,12 +739,13 @@ equality_ops_are_compatible(Oid opno1, Oid opno2)
738
739
* Return true if the two given comparison operators have compatible
739
740
* semantics.
740
741
*
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.)
744
746
*
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 .)
747
749
*/
748
750
bool
749
751
comparison_ops_are_compatible (Oid opno1 , Oid opno2 )
@@ -768,7 +770,7 @@ comparison_ops_are_compatible(Oid opno1, Oid opno2)
768
770
Form_pg_amop op_form = (Form_pg_amop ) GETSTRUCT (op_tuple );
769
771
IndexAmRoutine * amroutine = GetIndexAmRoutineByAmId (op_form -> amopmethod , false);
770
772
771
- if (amroutine -> amcanorder && amroutine -> amcancrosscompare )
773
+ if (amroutine -> amcanorder && amroutine -> amconsistentordering )
772
774
{
773
775
if (op_in_opfamily (opno2 , op_form -> amopfamily ))
774
776
{
0 commit comments