Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut2025-03-07 09:51:53 +0000
committerPeter Eisentraut2025-03-07 10:46:33 +0000
commitaf4002b381d86df6479962953d82f03ecb4e2e06 (patch)
tree70b568724f3dff02edcb4f6d3e87fa5711d59bb5 /src/backend/utils/cache
parent6da469badaffec32f8a804181cca279561467378 (diff)
Rename amcancrosscompare
After more discussion about commit ce62f2f2a0a, rename the index AM property amcancrosscompare to two separate properties amconsistentequality and amconsistentordering. Also improve the documentation and update some comments that were previously missed. Reported-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/E1tngY6-0000UL-2n%40gemulon.postgresql.org
Diffstat (limited to 'src/backend/utils/cache')
-rw-r--r--src/backend/utils/cache/lsyscache.c24
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))
{