mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
Fix handling of NaN values in BRIN minmax multi
When calculating distance between float4/float8 values, we need to be a bit more careful about NaN values in order not to trigger assert. We consider NaN values to be equal (distace 0.0) and in infinite distance from all other values. On builds without asserts, this issue is mostly harmless - the ranges may be merged in less efficient order, but the index is still correct. Per report from Andreas Seltenreich. Backpatch to 14, where this new BRIN opclass was introduced. Reported-by: Andreas Seltenreich Discussion: https://postgr.es/m/87r1bw9ukm.fsf@credativ.de
This commit is contained in:
@@ -347,6 +347,9 @@ SELECT brin_desummarize_range('brinidx_multi', 0);
|
||||
(1 row)
|
||||
|
||||
VACUUM brintest_multi; -- force a summarization cycle in brinidx
|
||||
-- Try inserting a values with NaN, to test distance calculation.
|
||||
insert into public.brintest_multi (float4col) values (real 'nan');
|
||||
insert into public.brintest_multi (float8col) values (real 'nan');
|
||||
UPDATE brintest_multi SET int8col = int8col * int4col;
|
||||
-- Tests for brin_summarize_new_values
|
||||
SELECT brin_summarize_new_values('brintest_multi'); -- error, not an index
|
||||
|
@@ -351,6 +351,10 @@ FROM tenk1 ORDER BY unique2 LIMIT 5 OFFSET 5;
|
||||
SELECT brin_desummarize_range('brinidx_multi', 0);
|
||||
VACUUM brintest_multi; -- force a summarization cycle in brinidx
|
||||
|
||||
-- Try inserting a values with NaN, to test distance calculation.
|
||||
insert into public.brintest_multi (float4col) values (real 'nan');
|
||||
insert into public.brintest_multi (float8col) values (real 'nan');
|
||||
|
||||
UPDATE brintest_multi SET int8col = int8col * int4col;
|
||||
|
||||
-- Tests for brin_summarize_new_values
|
||||
|
Reference in New Issue
Block a user