]> 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 19:08:12 +0000 (22:08 +0300)
commit02f90879e75b3d4ccdba1ec7c3cad6af08dff77d
tree9fc6dd6fdc3aba51027f5e02db15a0a271471882
parente5d8f3596100da0d38a38513c69e803b7fe7041a
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/backend/access/index/indexam.c
src/backend/access/spgist/spgscan.c
src/include/access/genam.h
src/include/access/gist_private.h
src/test/regress/expected/create_index.out