[postgis-tickets] [PostGIS] #3777: POINT EMPTY, POINT 0 0 anomaly

PostGIS trac at osgeo.org
Fri Jun 23 12:25:47 PDT 2017


#3777: POINT EMPTY, POINT 0 0 anomaly
----------------------+---------------------------
  Reporter:  robe     |      Owner:  pramsey
      Type:  defect   |     Status:  reopened
  Priority:  medium   |  Milestone:  PostGIS 2.3.3
 Component:  postgis  |    Version:  2.3.x
Resolution:           |   Keywords:
----------------------+---------------------------
Changes (by robe):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 I think there is still something wrong here. I'm testing on


 {{{
 PostgreSQL 9.6.1 on x86_64-w64-mingw32, compiled by gcc.exe (x86_64-win32
 -seh-rev4, Built by MinGW-W64 project) 4.9.2, 64-bit POSTGIS="2.3.3dev
 r15449" GEOS="3.6.1-CAPI-1.10.1 r4317" PROJ="Rel. 4.9.1, 04 March 2015"
 GDAL="GDAL 2.2.0, released 2017/04/28" LIBXML="2.7.8" LIBJSON="0.12"
 RASTER
 }}}




  The first query returns the right answer now:

 {{{
 SELECT ST_AsText(geom) txt, count(*)
 FROM (
 SELECT 'POINT(0 0)'::geometry geom
 UNION ALL
 SELECT 'POINT(0 0)'::geometry geom
 UNION ALL
 SELECT 'POINT(0 0)'::geometry geom
 UNION ALL
 SELECT 'POINT(0 1)'::geometry geom
 UNION ALL
 SELECT 'LINESTRING(0 0,0 1)'::geometry geom
 UNION ALL
 SELECT 'GEOMETRYCOLLECTION EMPTY'::geometry geom
 UNION ALL
 SELECT 'POINT EMPTY'::geometry geom
 ) foo
 GROUP BY geom;
 }}}



 Yields right answer:
 {{{
            txt            | count
 --------------------------+-------
  POINT(0 0)               |     3
  LINESTRING(0 0,0 1)      |     1
  POINT(0 1)               |     1
  GEOMETRYCOLLECTION EMPTY |     2
 (4 rows)
 }}}




 But if I switch the order of geometries, I get a different answer and
 again POINT(0 0) is not fully aggregated.


 {{{
 SELECT ST_AsText(geom) txt, count(*)
 FROM (
 SELECT 'POINT(0 0)'::geometry geom
 UNION ALL
 SELECT 'POINT(0 0)'::geometry geom
 UNION ALL
 SELECT 'POINT EMPTY'::geometry geom
 UNION ALL
 SELECT 'POINT(0 0)'::geometry geom
 UNION ALL
 SELECT 'POINT(0 1)'::geometry geom
 UNION ALL
 SELECT 'LINESTRING(0 0,0 1)'::geometry geom
 UNION ALL
 SELECT 'GEOMETRYCOLLECTION EMPTY'::geometry geom
 ) foo
 GROUP BY geom;
 }}}


 Gives:


 {{{
            txt            | count
 --------------------------+-------
  POINT(0 0)               |     2
  POINT EMPTY              |     1
  POINT(0 0)               |     1
  GEOMETRYCOLLECTION EMPTY |     1
  LINESTRING(0 0,0 1)      |     1
  POINT(0 1)               |     1
 (6 rows)


 Time: 4.227 ms
 }}}

--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3777#comment:12>
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