Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e39c4af

Browse files
committed
Fix potential platform dependence in gist regression test.
The results of the KNN-search test cases were indeterminate, as they asked the system to sort pairs of points that are exactly equidistant from the query reference point. It's a bit surprising that we've seen no platform-specific failures from this in the buildfarm. Perhaps IEEE-float math is well enough standardized that no such failures will ever occur on supported platforms ... but since this entire regression test has yet to be shipped in any non-alpha release, that seems like an unduly optimistic assumption. Tweak the queries so that the correct output is uniquely defined. (The other queries in this test are also underdetermined; but it looks like they are regurgitating index rows in insertion order, so for the moment assume that that behavior is stable enough.) Per Greg Stark's experiments with VAX. Back-patch to 9.5 where this test script was introduced.
1 parent 18391a8 commit e39c4af

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/test/regress/expected/gist.out

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,16 @@ select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5));
6161
-- Also test an index-only knn-search
6262
explain (costs off)
6363
select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5))
64-
order by p <-> point(0.2, 0.2);
64+
order by p <-> point(0.201, 0.201);
6565
QUERY PLAN
6666
--------------------------------------------------------
6767
Index Only Scan using gist_tbl_point_index on gist_tbl
6868
Index Cond: (p <@ '(0.5,0.5),(0,0)'::box)
69-
Order By: (p <-> '(0.2,0.2)'::point)
69+
Order By: (p <-> '(0.201,0.201)'::point)
7070
(3 rows)
7171

7272
select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5))
73-
order by p <-> point(0.2, 0.2);
73+
order by p <-> point(0.201, 0.201);
7474
p
7575
-------------
7676
(0.2,0.2)
@@ -80,32 +80,32 @@ order by p <-> point(0.2, 0.2);
8080
(0.1,0.1)
8181
(0.35,0.35)
8282
(0.05,0.05)
83-
(0,0)
8483
(0.4,0.4)
84+
(0,0)
8585
(0.45,0.45)
8686
(0.5,0.5)
8787
(11 rows)
8888

8989
-- Check commuted case as well
9090
explain (costs off)
9191
select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5))
92-
order by point(0.1, 0.1) <-> p;
92+
order by point(0.101, 0.101) <-> p;
9393
QUERY PLAN
9494
--------------------------------------------------------
9595
Index Only Scan using gist_tbl_point_index on gist_tbl
9696
Index Cond: (p <@ '(0.5,0.5),(0,0)'::box)
97-
Order By: (p <-> '(0.1,0.1)'::point)
97+
Order By: (p <-> '(0.101,0.101)'::point)
9898
(3 rows)
9999

100100
select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5))
101-
order by point(0.1, 0.1) <-> p;
101+
order by point(0.101, 0.101) <-> p;
102102
p
103103
-------------
104104
(0.1,0.1)
105105
(0.15,0.15)
106106
(0.05,0.05)
107-
(0,0)
108107
(0.2,0.2)
108+
(0,0)
109109
(0.25,0.25)
110110
(0.3,0.3)
111111
(0.35,0.35)

src/test/regress/sql/gist.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,18 @@ select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5));
5656
-- Also test an index-only knn-search
5757
explain (costs off)
5858
select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5))
59-
order by p <-> point(0.2, 0.2);
59+
order by p <-> point(0.201, 0.201);
6060

6161
select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5))
62-
order by p <-> point(0.2, 0.2);
62+
order by p <-> point(0.201, 0.201);
6363

6464
-- Check commuted case as well
6565
explain (costs off)
6666
select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5))
67-
order by point(0.1, 0.1) <-> p;
67+
order by point(0.101, 0.101) <-> p;
6868

6969
select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5))
70-
order by point(0.1, 0.1) <-> p;
70+
order by point(0.101, 0.101) <-> p;
7171

7272
drop index gist_tbl_point_index;
7373

0 commit comments

Comments
 (0)