[PostGIS] #6026: Distance operator <-> returns "tuple order" error

PostGIS trac at osgeo.org
Thu Apr 2 13:25:23 PDT 2026


#6026: Distance operator <-> returns "tuple order" error
----------------------+----------------------------------------------
  Reporter:  dirc     |      Owner:  pramsey
      Type:  defect   |     Status:  new
  Priority:  medium   |  Milestone:
 Component:  postgis  |    Version:  3.5.x
Resolution:           |   Keywords:  distance, operator, tuple, order
----------------------+----------------------------------------------
Comment (by pramsey):

 Shorter reproducer, just one row.
 {{{
 CREATE TABLE reproduce AS
   SELECT 1 AS id, ST_GeomFromText('POLYGON ((133917.695 490000, 133708.3
 491825.92, 133541.312 491951.805, 133460 491840, 132820 491000, 132210
 490190, 132460 490000, 132700 490000, 133894.531 490000, 133917.695
 490000))', 28992)::GEOMETRY(POLYGON, 28992) AS geometry;

 CREATE INDEX idx_reproduce_geometry
 ON reproduce USING GIST(geometry);

 SET enable_seqscan = OFF;

 SELECT
   id,
   geometry <-> ST_SetSRID(ST_MakePoint(133718, 489222), 28992) AS opdist,
   ST_Distance(geometry, ST_SetSRID(ST_MakePoint(133718, 489222), 28992))
 AS funcdist
 FROM reproduce;

 SELECT id
 FROM reproduce
 ORDER BY geometry <-> ST_SetSRID(ST_MakePoint(133718, 489222), 28992);
 }}}
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/6026#comment:3>
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