Opened 6 years ago

Closed 6 years ago

#1776 closed defect (fixed)

ST_SymDifference involging EMPTY not symmetric

Reported by: strk Owned by: pramsey
Priority: medium Milestone: PostGIS 2.0.1
Component: postgis Version: 2.0.x
Keywords: Cc:

Description

strk=# SELECT ST_AsText(ST_SymDifference('POLYGON((0 0, 10 0, 10 10, 0 0))', 'POLYGON EMPTY'));
           st_astext           
-------------------------------
 POLYGON((0 0,10 0,10 10,0 0))
(1 row)

strk=# SELECT ST_AsText(ST_SymDifference('POLYGON EMPTY', 'POLYGON((0 0, 10 0, 10 10, 0 0))'));
   st_astext   
---------------
 POLYGON EMPTY
(1 row)

I belive the first answer is correct and the second should be equal to the first one

Change History (4)

comment:1 Changed 6 years ago by strk

See #1775 for a consequence of this

comment:2 Changed 6 years ago by strk

The code shows this as being intentional:

        /* A.SymDifference(Empty) == A */
        if ( lwgeom_is_empty(geom2) )
                return lwgeom_clone(geom1);

        /* Empty.DymDifference(B) == Empty */
        if ( lwgeom_is_empty(geom1) )
                return lwgeom_clone(geom1);

What's the rationale for the second ??? I think it's just plain wrong !

comment:3 Changed 6 years ago by strk

1.5 is not affected by this bug, 2.0.0 is

comment:4 Changed 6 years ago by strk

Resolution: fixed
Status: newclosed

Fixed by r9641

Note: See TracTickets for help on using tickets.