From 866b58479537845014451cc1c0fe95fd4fb0639e Mon Sep 17 00:00:00 2001
From: Tender Wang <tndrwang@gmail.com>
Date: Fri, 19 Sep 2025 19:27:06 +0800
Subject: [PATCH] Use opresulttype to check instead of calling
 SearchSysCache1().

We can use opresulttype of OpExpr to check if it is BOOLOID.
So we can avoid caling SearchSysCache1(). This can save some CPU times.
---
 src/backend/optimizer/path/indxpath.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c
index 4f5c98f0091..ff24c120e69 100644
--- a/src/backend/optimizer/path/indxpath.c
+++ b/src/backend/optimizer/path/indxpath.c
@@ -3370,7 +3370,7 @@ match_orclause_to_indexcol(PlannerInfo *root,
 		Assert(bms_is_subset(subRinfo->required_relids, rinfo->required_relids));
 
 		/* Only the operator returning a boolean suit the transformation. */
-		if (get_op_rettype(opno) != BOOLOID)
+		if (subClause->opresulttype != BOOLOID)
 			break;
 
 		/*
-- 
2.34.1

