]> granicus.if.org Git - postgis/commitdiff
Make sure <#> order is unambiguous for first result
authorSandro Santilli <strk@keybit.net>
Tue, 24 Feb 2015 09:17:22 +0000 (09:17 +0000)
committerSandro Santilli <strk@keybit.net>
Tue, 24 Feb 2015 09:17:22 +0000 (09:17 +0000)
Before this commit the first 2 points (or more) all had a
bounding box distance of 0 so actual order was undefined

git-svn-id: http://svn.osgeo.org/postgis/trunk@13279 b70326c6-7e19-0410-871a-916f4a2858ee

regress/regress_index.sql
regress/regress_index_expected

index 582cca543f5178081f5ad06691162b8b77b77005..2837d14dea4148ab93d741aa35d08cfc67e16bb7 100644 (file)
@@ -47,15 +47,16 @@ SELECT 'scan_seq', qnodes('select * from test where the_geom && ST_MakePoint(0,0
 
 SELECT '<-> idx', qnodes('select * from test order by the_geom <-> ST_MakePoint(0,0)');
 SELECT '<-> res1',num,
-  ST_Distance(the_geom, 'LINESTRING(0 0,5 5)'::geometry)::numeric(10,2),
+  (the_geom <-> 'LINESTRING(0 0,5 5)'::geometry)::numeric(10,2),
   ST_astext(the_geom) from test
   order by the_geom <-> 'LINESTRING(0 0,5 5)'::geometry LIMIT 1;
 
+-- Full table extent: BOX(0.0439142361 0.0197799355,999.955261 999.993652)
 SELECT '<#> idx', qnodes('select * from test order by the_geom <#> ST_MakePoint(0,0)');
 SELECT '<#> res1',num,
-  ST_Distance(the_geom, 'LINESTRING(0 0,5 5)'::geometry)::numeric(10,2),
+  (the_geom <#> 'LINESTRING(1000 0,1005 5)'::geometry)::numeric(10,2),
   ST_astext(the_geom) from test
-  order by the_geom <#> 'LINESTRING(0 0,5 5)'::geometry LIMIT 1;
+  order by the_geom <#> 'LINESTRING(1000 0,1005 5)'::geometry LIMIT 1;
 
 CREATE FUNCTION estimate_error(qry text, tol int)
 RETURNS text
index df1b60941101cdb8207112199c83aef950003bbb..52f5dd1ff731e9c1c4a8283f9d523a7490e4aa71 100644 (file)
@@ -7,9 +7,9 @@ scan_seq|Index Scan
 3618|POINT(130.447205 131.655289)
 7245|POINT(128.10466 130.94133)
 <-> idx|Index Scan
-<-> res1|48589|0.08|POINT(2.33793712 2.44566727)
+<-> res1|48589|0.17|POINT(2.33793712 2.44566727)
 <#> idx|Index Scan
-<#> res1|48589|0.08|POINT(2.33793712 2.44566727)
+<#> res1|2057|0.83|POINT(999.173279 3.92185807)
 3+=5:true
 924+=60:true
 12621+=500:true