[postgis-tickets] [PostGIS] #3018: GROUP BY geography sometimes returns duplicate rows

PostGIS trac at osgeo.org
Wed Jan 21 14:47:50 PST 2015


#3018: GROUP BY geography sometimes returns duplicate rows
---------------------------+------------------------------------------------
 Reporter:  realityexists  |       Owner:  pramsey
     Type:  defect         |      Status:  new    
 Priority:  medium         |   Milestone:         
Component:  postgis        |     Version:  2.1.x  
 Keywords:                 |  
---------------------------+------------------------------------------------
 POSTGIS="2.1.5 r13152" GEOS="3.4.2-CAPI-1.8.2 r3924" PROJ="Rel. 4.8.0, 6
 March 2012" GDAL="GDAL 1.11.1, released 2014/09/24" LIBXML="2.7.8"
 LIBJSON="UNKNOWN" RASTER
 PostgreSQL 9.3.5, 64-bit, running on Windows 7 SP1

 GROUP BY on a geography(Point) column doesn't seem to always group
 together the same value, unless it has a small number of rows as input.

 Restore the attached table with 500 geography points, some of which are
 duplicates.

 This query returns 1 row with a count of 6, as expected:
 {{{
         SELECT pos, COUNT(*)
         FROM my_test_data
         WHERE pos = '0101000020E610000014AE47E17A141640CC834FCEAB914640'
         GROUP BY 1;
 }}}

 However, this query unexpectedly returns 6 rows, each with a count 1:
 {{{
         WITH sub AS
         (
                 SELECT pos, COUNT(*)
                 FROM my_test_data
                 GROUP BY 1
         )
         SELECT *
         FROM sub
         WHERE pos = '0101000020E610000014AE47E17A141640CC834FCEAB914640';
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/3018>
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