]> granicus.if.org Git - postgresql/commit
Improve handling of NULLs in KNN-GiST and KNN-SP-GiST
authorAlexander Korotkov <akorotkov@postgresql.org>
Thu, 19 Sep 2019 18:30:19 +0000 (21:30 +0300)
committerAlexander Korotkov <akorotkov@postgresql.org>
Thu, 19 Sep 2019 18:50:00 +0000 (21:50 +0300)
commit2da8e56db35cf3759c22b97bcb22216837dec3e1
treea9cdab638837d3458ec7da31ea09fd1ce68ea2e1
parentd84db2d3a0e3fdc742a014dc413d650dda7c6051
Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

This commit improves subject in two ways:

 * It removes ugliness of 02f90879e7, which stores distance values and null
   flags in two separate arrays after GISTSearchItem struct.  Instead we pack
   both distance value and null flag in IndexOrderByDistance struct.  Alignment
   overhead should be negligible, because we typically deal with at most few
   "col op const" expressions in ORDER BY clause.
 * It fixes handling of "col op NULL" expression in KNN-SP-GiST.  Now, these
   expression are not passed to support functions, which can't deal with them.
   Instead, NULL result is implicitly assumed.  It future we may decide to
   teach support functions to deal with NULL arguments, but current solution is
   bugfix suitable for backpatch.

Reported-by: Nikita Glukhov
Discussion: https://postgr.es/m/826f57ee-afc7-8977-c44c-6111d18b02ec%40postgrespro.ru
Author: Nikita Glukhov
Reviewed-by: Alexander Korotkov
Backpatch-through: 9.4
src/backend/access/gist/gistget.c
src/backend/access/gist/gistscan.c
src/include/access/genam.h
src/include/access/gist_private.h
src/tools/pgindent/typedefs.list