pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix handling of NaN values in BRIN minmax multi
Date: Sat, 06 Nov 2021 00:55:28 +0000
Message-ID: <E1mj9zU-0003Sr-Br@gemulon.postgresql.org> (raw)

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(+)



view thread (2+ messages)

Message-ID: <E1mj9zU-0003Sr-Br@gemulon.postgresql.org>
Permalink:  ../E1mj9zU-0003Sr-Br@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1mj9zU-0003Sr-Br@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tomas.vondra@postgresql.org
  Subject: Re: pgsql: Fix handling of NaN values in BRIN minmax multi
  In-Reply-To: <E1mj9zU-0003Sr-Br@gemulon.postgresql.org>
  References: <E1mj9zU-0003Sr-Br@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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