[postgis-tickets] [PostGIS] #3131: KNN geography still gives ERROR: index returned tuples in wrong order

PostGIS trac at osgeo.org
Tue May 26 13:54:14 PDT 2015


#3131: KNN geography still gives  ERROR:  index returned tuples in wrong order
---------------------+---------------------------
 Reporter:  robe     |      Owner:  pramsey
     Type:  defect   |     Status:  new
 Priority:  blocker  |  Milestone:  PostGIS 2.2.0
Component:  postgis  |    Version:  trunk
 Keywords:           |
---------------------+---------------------------
 I thought we were over this issue, but in trying to troubleshoot why my
 regress geography weren't using an idnex (which I thought they were
 before), I am getting back this error:

 Steps to produce:


 {{{
 CREATE TABLE knn_recheck_geog(gid serial primary key, geog geography);
 INSERT INTO knn_recheck_geog(gid,geog)
 SELECT ROW_NUMBER() OVER(ORDER BY x,y) AS gid,
 ST_Point(x*1.11,y*0.95)::geography As geog
 FROM generate_series(-100,100, 1) AS x CROSS JOIN
 generate_series(-90,90,1) As y;

 INSERT INTO knn_recheck_geog(gid, geog)
 SELECT 500000, 'LINESTRING(-95 -10, -11 65, 5 10, -70 60)'::geography;

 INSERT INTO knn_recheck_geog(gid, geog)
 SELECT 500001, 'POLYGON((-95 10, -95.6 10.5, -95.9 10.75, -95
 10))'::geography;

 INSERT INTO knn_recheck_geog(gid,geog)
 SELECT 600000 + ROW_NUMBER() OVER(ORDER BY gid) AS gid,
 ST_Buffer(geog,1000) As geog
 FROM knn_recheck_geog
 WHERE gid IN(1000, 10000, 2000, 2614, 40000);

 CREATE INDEX idx_knn_recheck_geog_gist ON knn_recheck_geog USING
 gist(geog);

 set enable_seqscan = false;
 SELECT gid
 FROM knn_recheck_geog
 ORDER BY 'POINT(95 10)'::geography <-> geog LIMIT 5;
 }}}

 Out comes:

 {{{
 ERROR:  index returned tuples in wrong order
 }}}

 My postgis_full_version

 {{{
 SELECT postgis_full_version() || ' ' || ' ' || version();
 }}}

 {{{
 POSTGIS="2.2.0dev r13565" GEOS="3.5.0dev-CAPI-1.9.0 r4034" PROJ="Rel.
 4.8.0, 6 March 2012" GDAL="GDAL 1.11.1, released 2014/09/24"
 LIBXML="2.7.8" LIBJSON="0.12" RASTER  PostgreSQL 9.5devel on
 x86_64-w64-mingw32, compiled by gcc.exe (x86_64-win32-seh-rev1, Built by
 MinGW-W64 project) 4.8.3, 64-bit
 }}}

--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/3131>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list