From 6cb2801ce6b1273555a8ac930a27631a242a4c45 Mon Sep 17 00:00:00 2001 From: Tomas Vondra Date: Wed, 15 Feb 2023 12:39:23 +0100 Subject: [PATCH 1/9] BRIN bloom cleanup Minor cleanup of the BRIN bloom code - use the proper data type for the boolean variable, and correct comment copied from minmax. --- src/backend/access/brin/brin_bloom.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/backend/access/brin/brin_bloom.c b/src/backend/access/brin/brin_bloom.c index e4953a9d37b..6c716924fff 100644 --- a/src/backend/access/brin/brin_bloom.c +++ b/src/backend/access/brin/brin_bloom.c @@ -574,7 +574,7 @@ brin_bloom_consistent(PG_FUNCTION_ARGS) Oid colloid = PG_GET_COLLATION(); AttrNumber attno; Datum value; - Datum matches; + bool matches; FmgrInfo *finfo; uint32 hashValue; BloomFilter *filter; @@ -584,6 +584,7 @@ brin_bloom_consistent(PG_FUNCTION_ARGS) Assert(filter); + /* assume all scan keys match */ matches = true; for (keyno = 0; keyno < nkeys; keyno++) @@ -601,9 +602,8 @@ brin_bloom_consistent(PG_FUNCTION_ARGS) case BloomEqualStrategyNumber: /* - * In the equality case (WHERE col = someval), we want to - * return the current page range if the minimum value in the - * range <= scan key, and the maximum value >= scan key. + * We want to return the current page range if the bloom filter + * seems to contain the value. */ finfo = bloom_get_procinfo(bdesc, attno, PROCNUM_HASH); @@ -614,7 +614,7 @@ brin_bloom_consistent(PG_FUNCTION_ARGS) default: /* shouldn't happen */ elog(ERROR, "invalid strategy number %d", key->sk_strategy); - matches = 0; + matches = false; break; } @@ -622,7 +622,7 @@ brin_bloom_consistent(PG_FUNCTION_ARGS) break; } - PG_RETURN_DATUM(matches); + PG_RETURN_BOOL(matches); } /* -- 2.40.1