Fix handling Inf and Nan values in GiST pairing heap comparator
authorAlexander Korotkov <[email protected]>
Sun, 8 Sep 2019 18:07:30 +0000 (21:07 +0300)
committerAlexander Korotkov <[email protected]>
Sun, 8 Sep 2019 18:48:44 +0000 (21:48 +0300)
commitb2037afec14725e4521427edbee8071d04057a2d
treeee1bd2414198fca76f1a147a698e0e453a9a094f
parent984ee0f6df06980a96b688342aad84ef47aea1fe
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
src/backend/access/gist/gistscan.c