indxpath.patch

text/plain

Filename: indxpath.patch
Type: text/plain
Part: 0
Message: Bug: When user-defined AM is used, the index path cannot be selected correctly

Patch

Format: unified
File+
src/backend/optimizer/path/indxpath.c 1 1
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c
index 7d176e7b00..31229ce16c 100644
--- a/src/backend/optimizer/path/indxpath.c
+++ b/src/backend/optimizer/path/indxpath.c
@@ -2295,7 +2295,7 @@ match_clause_to_indexcol(PlannerInfo *root,
 
 	/* First check for boolean-index cases. */
 	opfamily = index->opfamily[indexcol];
-	if (IsBooleanOpfamily(opfamily))
+	if (IsBooleanOpfamily(opfamily) || IsA(clause, BoolExpr) || IsA(clause, Var))
 	{
 		iclause = match_boolean_index_clause(root, rinfo, indexcol, index);
 		if (iclause)