aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/spgist
diff options
context:
space:
mode:
authorAlexander Korotkov <akorotkov@postgresql.org>2019-09-25 01:47:36 +0300
committerAlexander Korotkov <akorotkov@postgresql.org>2019-09-25 01:47:36 +0300
commit90c0987258264de07780f0329db2fce83098fba8 (patch)
tree4d9911400682388b103fc08f09dd357481edfaba /src/backend/access/spgist
parent709d003fbd98b975a4fbcb4c5750fa6efaf9ad87 (diff)
downloadpostgresql-90c0987258264de07780f0329db2fce83098fba8.tar.gz
postgresql-90c0987258264de07780f0329db2fce83098fba8.zip
Fix bug in pairingheap_SpGistSearchItem_cmp()
Our item contains only so->numberOfNonNullOrderBys of distances. Reflect that in the loop upper bound. Discussion: https://postgr.es/m/53536807-784c-e029-6e92-6da802ab8d60%40postgrespro.ru Author: Nikita Glukhov Backpatch-through: 12
Diffstat (limited to 'src/backend/access/spgist')
-rw-r--r--src/backend/access/spgist/spgscan.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/access/spgist/spgscan.c b/src/backend/access/spgist/spgscan.c
index cfba47067cc..6e940fd3def 100644
--- a/src/backend/access/spgist/spgscan.c
+++ b/src/backend/access/spgist/spgscan.c
@@ -56,7 +56,7 @@ pairingheap_SpGistSearchItem_cmp(const pairingheap_node *a,
else
{
/* Order according to distance comparison */
- for (i = 0; i < so->numberOfOrderBys; i++)
+ for (i = 0; i < so->numberOfNonNullOrderBys; i++)
{
if (isnan(sa->distances[i]) && isnan(sb->distances[i]))
continue; /* NaN == NaN */