pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix handling of NaN values in BRIN minmax multi
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix handling of NaN values in BRIN minmax multi
@ 2021-11-06 00:53  Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Tomas Vondra @ 2021-11-06 00:53 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d91353f4b21f10417d142e6ac17a0490adae867c

Modified Files
--------------
src/backend/access/brin/brin_minmax_multi.c | 17 +++++++++++++++++
src/test/regress/expected/brin_multi.out    |  3 +++
src/test/regress/sql/brin_multi.sql         |  4 ++++
3 files changed, 24 insertions(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix handling of NaN values in BRIN minmax multi
@ 2021-11-06 00:55  Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Tomas Vondra @ 2021-11-06 00:55 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f7829feb759ef54d9adcc696fa8345e280ed423b

Modified Files
--------------
src/backend/access/brin/brin_minmax_multi.c | 17 +++++++++++++++++
src/test/regress/expected/brin_multi.out    |  3 +++
src/test/regress/sql/brin_multi.sql         |  4 ++++
3 files changed, 24 insertions(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-11-06 00:55 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-11-06 00:53 pgsql: Fix handling of NaN values in BRIN minmax multi Tomas Vondra <tomas.vondra@postgresql.org>
2021-11-06 00:55 pgsql: Fix handling of NaN values in BRIN minmax multi Tomas Vondra <tomas.vondra@postgresql.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox