diff options
author | Michael Paquier | 2023-11-08 05:06:26 +0000 |
---|---|---|
committer | Michael Paquier | 2023-11-08 05:06:26 +0000 |
commit | 1b2c6b756eaae5203af887973b306882fb477836 (patch) | |
tree | 38998b5e860e68601b0236e83494942edb5be4c2 | |
parent | 615f5f6faa0fb659c4e20e1d2137a869cd33058b (diff) |
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/[email protected]
Backpatch-through: 14
-rw-r--r-- | src/backend/access/brin/brin_bloom.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/backend/access/brin/brin_bloom.c b/src/backend/access/brin/brin_bloom.c index 56534cf29c..5bfaffe59b 100644 --- a/src/backend/access/brin/brin_bloom.c +++ b/src/backend/access/brin/brin_bloom.c @@ -320,8 +320,7 @@ bloom_init(int ndistinct, double false_positive_rate) int nhashes; /* number of hash functions */ Assert(ndistinct > 0); - Assert((false_positive_rate >= BLOOM_MIN_FALSE_POSITIVE_RATE) && - (false_positive_rate < BLOOM_MAX_FALSE_POSITIVE_RATE)); + Assert(false_positive_rate > 0 && false_positive_rate < 1); /* calculate bloom filter size / parameters */ bloom_filter_size(ndistinct, false_positive_rate, |