From e39c4afcfa0fb2c708e49e54089118d9b4ba5f89 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 25 Aug 2015 11:43:37 -0400 Subject: [PATCH] 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. --- src/test/regress/expected/gist.out | 16 ++++++++-------- src/test/regress/sql/gist.sql | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/test/regress/expected/gist.out b/src/test/regress/expected/gist.out index 1c32612d5b..c7181b0397 100644 --- a/src/test/regress/expected/gist.out +++ b/src/test/regress/expected/gist.out @@ -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) diff --git a/src/test/regress/sql/gist.sql b/src/test/regress/sql/gist.sql index 7aa688ef42..9d4ff1e97e 100644 --- a/src/test/regress/sql/gist.sql +++ b/src/test/regress/sql/gist.sql @@ -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;