]> granicus.if.org Git - postgresql/commit
Fix handling of NULL distances in KNN-GiST
authorAlexander Korotkov <akorotkov@postgresql.org>
Sun, 8 Sep 2019 18:13:40 +0000 (21:13 +0300)
committerAlexander Korotkov <akorotkov@postgresql.org>
Sun, 8 Sep 2019 18:47:34 +0000 (21:47 +0300)
commit92f6b49c48a3b9c829d4117d59e89128455dbf5f
treed4c57c3d69ff8b3f278bc2f62dd065d92508dc0b
parent8f724002e2fe0e415f5a603462440d2f297f287c
Fix handling of NULL distances in KNN-GiST

In order to implement NULL LAST semantic GiST previously assumed distance to
the NULL value to be Inf.  However, our distance functions can return Inf and
NaN for non-null values.  In such cases, NULL LAST semantic appears to be
broken.  This commit fixes that by introducing separate array of null flags for
distances.

Backpatch to all supported versions.

Discussion: https://postgr.es/m/CAPpHfdsNvNdA0DBS%2BwMpFrgwT6C3-q50sFVGLSiuWnV3FqOJuQ%40mail.gmail.com
Author: Alexander Korotkov
Backpatch-through: 9.4
src/backend/access/gist/gistget.c
src/backend/access/gist/gistscan.c
src/include/access/gist_private.h