]> granicus.if.org Git - postgresql/commitdiff
Fix potential platform dependence in gist regression test.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 25 Aug 2015 15:43:37 +0000 (11:43 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 25 Aug 2015 15:43:37 +0000 (11:43 -0400)
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.

src/test/regress/expected/gist.out
src/test/regress/sql/gist.sql

index 1c32612d5bc43f3e9581ff00c5756b3adc5e9bfc..c7181b0397ec4688a416b40eb0d7233f8632c552 100644 (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)
index 7aa688ef42120bfdaa4c7058bdc06bf3b079b801..9d4ff1e97e970c7b2a2558014c7765dbfaa47d94 100644 (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;