Opened 12 years ago

Closed 12 years ago

#1453 closed defect (fixed)

ST_Equals(empty, empty) returns false

Reported by: strk Owned by: pramsey
Priority: medium Milestone: PostGIS 2.0.0
Component: postgis Version: master
Keywords: Cc:

Description

Empty isn't equal to self. Shouldn't it ?

Change History (7)

comment:1 by strk, 12 years ago

ST_orderingEquals has the same bug

comment:2 by strk, 12 years ago

Gah, it has to do with $1 ~= $2 !!! Both are affected because both insist in requiring bounding box overlap for two geometries to be equal. Does the EMPTY bounding box overlap the EMPTY bounding box ?

Do voids touch ?

comment:3 by strk, 12 years ago

Actually, ST_Equals uses && and ST_OrderingEquals uses ~=. That is overlaps and contains samebox.

Speaking of which… I'd use samebox for ST_Equals as well, and have samebox return TRUE for empty. They do have the same box !

comment:4 by strk, 12 years ago

r8778 fixes ~= and thus ST_OrderingEquals.

ST_Equals is still broken.

comment:5 by strk, 12 years ago

So, ST_Equals is broken only because of the use of && done by the SQL wrapper. _ST_Equals already returns true for 2 EMPTY parameters (no matter type and dimension).

I propose to switch ST_Equals to use ~= which means "same box". There should be no issue with floats vs. double as we always round boxes to float be them computed or cached. If we still don't it's a bug in our side which we want to fix.

comment:6 by strk, 12 years ago

Politics took over science: http://postgis.refractions.net/pipermail/postgis-devel/2012-January/017743.html

At time of writing we have:

-0 regina
+0 pramsey
+1 strk
+1 chodgson

Unless Mark vetoes out the motion passed for EMPTY being equal to EMPTY.

comment:7 by strk, 12 years ago

Resolution: fixed
Status: newclosed

I've fixed ST_Equals to return TRUE (consistently with _ST_Equals) with r8886.

Note: See TracTickets for help on using tickets.