Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit749b04d

Browse files
committed
Fix handling Inf and Nan values in GiST pairing heap comparator
Previously plain float comparison was used in GiST pairing heap. Suchcomparison doesn't provide proper ordering for value sets containing Inf and Nanvalues. This commit fixes that by usage of float8_cmp_internal(). Note, thereis remaining problem with NULL distances, which are represented as Inf inpairing heap. It would be fixes in subsequent commit.Backpatch to all supported versions.Reported-by: Andrey BorodinDiscussion:https://postgr.es/m/CAPpHfdsNvNdA0DBS%2BwMpFrgwT6C3-q50sFVGLSiuWnV3FqOJuQ%40mail.gmail.comAuthor: Alexander KorotkovReviewed-by: Heikki LinnakangasBackpatch-through: 9.4
1 parent7babff1 commit749b04d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎src/backend/access/gist/gistscan.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include"access/gist_private.h"
1818
#include"access/gistscan.h"
1919
#include"access/relscan.h"
20+
#include"utils/builtins.h"
2021
#include"utils/lsyscache.h"
2122
#include"utils/memutils.h"
2223
#include"utils/rel.h"
@@ -36,8 +37,10 @@ pairingheap_GISTSearchItem_cmp(const pairingheap_node *a, const pairingheap_node
3637
/* Order according to distance comparison */
3738
for (i=0;i<scan->numberOfOrderBys;i++)
3839
{
39-
if (sa->distances[i]!=sb->distances[i])
40-
return (sa->distances[i]<sb->distances[i]) ?1 :-1;
40+
intcmp=-float8_cmp_internal(sa->distances[i],sb->distances[i]);
41+
42+
if (cmp!=0)
43+
returncmp;
4144
}
4245

4346
/* Heap items go before inner pages, to ensure a depth-first search */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp