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.
This commit is contained in:
Tom Lane 2015-08-25 11:43:37 -04:00
parent 18391a8f06
commit e39c4afcfa
2 changed files with 12 additions and 12 deletions

View File

@ -61,16 +61,16 @@ select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5));
-- Also test an index-only knn-search
explain (costs off)
select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5))
order by p <-> point(0.2, 0.2);
order by p <-> point(0.201, 0.201);
QUERY PLAN
--------------------------------------------------------
Index Only Scan using gist_tbl_point_index on gist_tbl
Index Cond: (p <@ '(0.5,0.5),(0,0)'::box)
Order By: (p <-> '(0.2,0.2)'::point)
Order By: (p <-> '(0.201,0.201)'::point)
(3 rows)
select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5))
order by p <-> point(0.2, 0.2);
order by p <-> point(0.201, 0.201);
p
-------------
(0.2,0.2)
@ -80,8 +80,8 @@ order by p <-> point(0.2, 0.2);
(0.1,0.1)
(0.35,0.35)
(0.05,0.05)
(0,0)
(0.4,0.4)
(0,0)
(0.45,0.45)
(0.5,0.5)
(11 rows)
@ -89,23 +89,23 @@ order by p <-> point(0.2, 0.2);
-- Check commuted case as well
explain (costs off)
select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5))
order by point(0.1, 0.1) <-> p;
order by point(0.101, 0.101) <-> p;
QUERY PLAN
--------------------------------------------------------
Index Only Scan using gist_tbl_point_index on gist_tbl
Index Cond: (p <@ '(0.5,0.5),(0,0)'::box)
Order By: (p <-> '(0.1,0.1)'::point)
Order By: (p <-> '(0.101,0.101)'::point)
(3 rows)
select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5))
order by point(0.1, 0.1) <-> p;
order by point(0.101, 0.101) <-> p;
p
-------------
(0.1,0.1)
(0.15,0.15)
(0.05,0.05)
(0,0)
(0.2,0.2)
(0,0)
(0.25,0.25)
(0.3,0.3)
(0.35,0.35)

View File

@ -56,18 +56,18 @@ select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5));
-- Also test an index-only knn-search
explain (costs off)
select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5))
order by p <-> point(0.2, 0.2);
order by p <-> point(0.201, 0.201);
select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5))
order by p <-> point(0.2, 0.2);
order by p <-> point(0.201, 0.201);
-- Check commuted case as well
explain (costs off)
select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5))
order by point(0.1, 0.1) <-> p;
order by point(0.101, 0.101) <-> p;
select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5))
order by point(0.1, 0.1) <-> p;
order by point(0.101, 0.101) <-> p;
drop index gist_tbl_point_index;