diff --git a/src/backend/access/gin/ginget.c b/src/backend/access/gin/ginget.c
index 553500cec0..27984edbea 100644
--- a/src/backend/access/gin/ginget.c
+++ b/src/backend/access/gin/ginget.c
@@ -1535,7 +1535,7 @@ scanGetCandidate(IndexScanDesc scan, pendingPosition *pos)
  * datum[]/category[]/datumExtracted[] arrays are used to cache the results
  * of gintuple_get_key() on the current page.
  */
-static bool
+static char
 matchPartialInPendingList(GinState *ginstate, Page page,
 						  OffsetNumber off, OffsetNumber maxoff,
 						  GinScanEntry entry,
@@ -1547,14 +1547,14 @@ matchPartialInPendingList(GinState *ginstate, Page page,
 
 	/* Partial match to a null is not possible */
 	if (entry->queryCategory != GIN_CAT_NORM_KEY)
-		return false;
+		return GIN_FALSE;
 
 	while (off < maxoff)
 	{
 		itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, off));
 
 		if (gintuple_get_attrnum(ginstate, itup) != entry->attnum)
-			return false;
+			return GIN_FALSE;
 
 		if (datumExtracted[off - 1] == false)
 		{
@@ -1565,7 +1565,7 @@ matchPartialInPendingList(GinState *ginstate, Page page,
 
 		/* Once we hit nulls, no further match is possible */
 		if (category[off - 1] != GIN_CAT_NORM_KEY)
-			return false;
+			return GIN_FALSE;
 
 		/*----------
 		 * Check partial match.
@@ -1581,14 +1581,14 @@ matchPartialInPendingList(GinState *ginstate, Page page,
 											  UInt16GetDatum(entry->strategy),
 											  PointerGetDatum(entry->extra_data)));
 		if (cmp == 0)
-			return true;
+			return GIN_TRUE;
 		else if (cmp > 0)
-			return false;
+			return GIN_FALSE;
 
 		off++;
 	}
 
-	return false;
+	return GIN_FALSE;
 }
 
 /*
@@ -1653,7 +1653,7 @@ collectMatchesForHeapRow(IndexScanDesc scan, pendingPosition *pos)
 							StopMiddle;
 
 				/* If already matched on earlier page, do no extra work */
-				if (key->entryRes[j])
+				if (key->entryRes[j] == GIN_TRUE)
 					continue;
 
 				/*
@@ -1740,7 +1740,7 @@ collectMatchesForHeapRow(IndexScanDesc scan, pendingPosition *pos)
 														  category,
 														  datumExtracted);
 						else
-							key->entryRes[j] = true;
+							key->entryRes[j] = GIN_TRUE;
 
 						/* done with binary search */
 						break;
@@ -1772,7 +1772,7 @@ collectMatchesForHeapRow(IndexScanDesc scan, pendingPosition *pos)
 												  datumExtracted);
 				}
 
-				pos->hasMatchKey[i] |= key->entryRes[j];
+				pos->hasMatchKey[i] = (pos->hasMatchKey[i] || key->entryRes[j] == GIN_TRUE);
 			}
 		}
