Skip to content

Commit 1b2c6b7

Browse files
committed
Enlarge assertion in bloom_init() for false_positive_rate
false_positive_rate is a parameter that can be set with the bloom opclass in BRIN, and setting it to a value of exactly 0.25 would trigger an assertion in the first INSERT done on the index with value set. The assertion changed here relied on BLOOM_{MIN|MAX}_FALSE_POSITIVE_RATE that are somewhat arbitrary values, and specifying an out-of-range value would also trigger a failure when defining such an index. So, as-is, the assertion was just doubling on the min-max check of the reloption. This is now enlarged to check that it is a correct percentage value, instead, based on a suggestion by Tom Lane. Author: Alexander Lakhin Reviewed-by: Tom Lane, Shihao Zhong Discussion: https://postgr.es/m/17969-a6c54de48026d694@postgresql.org Backpatch-through: 14
1 parent 615f5f6 commit 1b2c6b7

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/backend/access/brin/brin_bloom.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,7 @@ bloom_init(int ndistinct, double false_positive_rate)
320320
int nhashes; /* number of hash functions */
321321

322322
Assert(ndistinct > 0);
323-
Assert((false_positive_rate >= BLOOM_MIN_FALSE_POSITIVE_RATE) &&
324-
(false_positive_rate < BLOOM_MAX_FALSE_POSITIVE_RATE));
323+
Assert(false_positive_rate > 0 && false_positive_rate < 1);
325324

326325
/* calculate bloom filter size / parameters */
327326
bloom_filter_size(ndistinct, false_positive_rate,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy