pgsql: Fix handling Inf and Nan values in GiST pairing heap comparator

From: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix handling Inf and Nan values in GiST pairing heap comparator
Date: 2019-09-08 19:30:34
Message-ID: E1i72tO-0001Oq-Lh@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix handling Inf and Nan values in GiST pairing heap comparator

Previously plain float comparison was used in GiST pairing heap. Such
comparison doesn't provide proper ordering for value sets containing Inf and Nan
values. This commit fixes that by usage of float8_cmp_internal(). Note, there
is remaining problem with NULL distances, which are represented as Inf in
pairing heap. It would be fixes in subsequent commit.

Backpatch to all supported versions.

Reported-by: Andrey Borodin
Discussion: https://postgr.es/m/CAPpHfdsNvNdA0DBS%2BwMpFrgwT6C3-q50sFVGLSiuWnV3FqOJuQ%40mail.gmail.com
Author: Alexander Korotkov
Reviewed-by: Heikki Linnakangas
Backpatch-through: 9.4

Branch
------
master

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

Modified Files
--------------
src/backend/access/gist/gistscan.c | 7 +++++--
src/test/regress/expected/create_index.out | 10 +++++-----
2 files changed, 10 insertions(+), 7 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alexander Korotkov 2019-09-08 19:30:44 pgsql: Fix handling Inf and Nan values in GiST pairing heap comparator
Previous Message Tom Lane 2019-09-08 17:45:48 pgsql: configure: Update python search order