v22-0009-WIP-Generalize-index-support-in-range-type-suppo.patch

text/plain

Filename: v22-0009-WIP-Generalize-index-support-in-range-type-suppo.patch
Type: text/plain
Part: 8
Message: Re: Index AM API cleanup

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch v22-0009
Subject: WIP: Generalize index support in range type support functions
File+
src/backend/utils/adt/rangetypes.c 4 4
From f68f2d5da1f81f8d2523e91f0faffb559f37264a Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Wed, 19 Mar 2025 12:12:15 +0100
Subject: [PATCH v22 09/10] WIP: Generalize index support in range type support
 functions

FIXME: This is ineffective as long as findRangeSubOpclass() hardcodes
btree.
---
 src/backend/utils/adt/rangetypes.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/backend/utils/adt/rangetypes.c b/src/backend/utils/adt/rangetypes.c
index 5f9fb23871a..47878615136 100644
--- a/src/backend/utils/adt/rangetypes.c
+++ b/src/backend/utils/adt/rangetypes.c
@@ -2914,21 +2914,21 @@ build_bound_expr(Expr *elemExpr, Datum val,
 	int16		elemTypeLen = typeCache->typlen;
 	bool		elemByValue = typeCache->typbyval;
 	Oid			elemCollation = typeCache->typcollation;
-	int16		strategy;
+	CompareType cmptype;
 	Oid			oproid;
 	Expr	   *constExpr;
 
 	/* Identify the comparison operator to use */
 	if (isLowerBound)
-		strategy = isInclusive ? BTGreaterEqualStrategyNumber : BTGreaterStrategyNumber;
+		cmptype = isInclusive ? COMPARE_GE : COMPARE_GT;
 	else
-		strategy = isInclusive ? BTLessEqualStrategyNumber : BTLessStrategyNumber;
+		cmptype = isInclusive ? COMPARE_LE : COMPARE_LT;
 
 	/*
 	 * We could use exprType(elemExpr) here, if it ever becomes possible that
 	 * elemExpr is not the exact same type as the range elements.
 	 */
-	oproid = get_opfamily_member(opfamily, elemType, elemType, strategy);
+	oproid = get_opfamily_member_for_cmptype(opfamily, elemType, elemType, cmptype);
 
 	/* We don't really expect failure here, but just in case ... */
 	if (!OidIsValid(oproid))
-- 
2.49.0