Opened 8 years ago

Closed 8 years ago

#3521 closed defect (invalid)

Wrong result of <select distinct geometry from XXX>

Reported by: yuanrui1987 Owned by: pramsey
Priority: high Milestone: PostGIS 2.2.2
Component: postgis Version: 1.5.X
Keywords: Cc:



Sorry to bother. I have encountered the following problem, please help me.

I have one table, and its name is <temp_union_test>, the column of geometry is <the_geom>. there are two geometries, and they have the same bounding box. when I execute < select distinct the_geom from temp_union_test >, there is only one row returned, but actually, the two geometries is totally different. I have tried this execution on PostGIS 1.5 and PostGIS 2.0, the results is always the same.

Would you help me to solve this problem? If you have any concern about it, I would be very appreciate it. Thank you.

Attachments (1) (5.3 KB ) - added by yuanrui1987 8 years ago.
The two geometries

Download all attachments as: .zip

Change History (2)

by yuanrui1987, 8 years ago

Attachment: added

The two geometries

comment:1 by robe, 8 years ago

Milestone: PostGIS 2.2.2
Resolution: invalid
Status: newclosed

This is not a bug, but by design. When you use DISTINCT it uses the = operator which is tied to bounding box equality not geometry equality.

You could group by or distinct on geom::text to get what you want.

Anyrate please ask for help on our mailing list, not our bug tracker.

Note: See TracTickets for help on using tickets.