Opened 9 years ago

Closed 9 years ago

#3018 closed defect (fixed)

GROUP BY geography sometimes returns duplicate rows

Reported by: realityexists Owned by: pramsey
Priority: medium Milestone:
Component: postgis Version: 2.1.x
Keywords: Cc:

Description

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';

Attachments (1)

bug3018_test_data.sql (30.2 KB ) - added by realityexists 9 years ago.
Test data

Download all attachments as: .zip

Change History (2)

by realityexists, 9 years ago

Attachment: bug3018_test_data.sql added

Test data

comment:1 by pramsey, 9 years ago

Resolution: fixed
Status: newclosed

Fixed in 2.0 at r13435, 2.1 at r13436, trunk at r13437

Note: See TracTickets for help on using tickets.