Fix handling of NaN values in BRIN minmax multi
authorTomas Vondra <[email protected]>
Sat, 6 Nov 2021 00:25:31 +0000 (01:25 +0100)
committerTomas Vondra <[email protected]>
Sat, 6 Nov 2021 00:53:36 +0000 (01:53 +0100)
commitf7829feb759ef54d9adcc696fa8345e280ed423b
tree0b2279a3da34339f451429066018d331a51f6659
parent39387228c8b7043d168bada0c64e9f59e83285f5
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/[email protected]
src/backend/access/brin/brin_minmax_multi.c
src/test/regress/expected/brin_multi.out
src/test/regress/sql/brin_multi.sql