]> granicus.if.org Git - postgis/commitdiff
fix ST_SymDifference(empty, geom) to return geom (#1776)
authorSandro Santilli <strk@keybit.net>
Fri, 13 Apr 2012 21:04:15 +0000 (21:04 +0000)
committerSandro Santilli <strk@keybit.net>
Fri, 13 Apr 2012 21:04:15 +0000 (21:04 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@9641 b70326c6-7e19-0410-871a-916f4a2858ee

NEWS
liblwgeom/lwgeom_geos.c
regress/tickets.sql
regress/tickets_expected

diff --git a/NEWS b/NEWS
index cfc0c8f43b342c19a8f3ea8fc78dbb7bd7325058..d59a719d286c7c27afa1c32dd5c42e781909d4fb 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ PostGIS 2.0.1
 
 * Bug Fixes *
 
+  - #1776, fix ST_SymDifference(empty, geom) to return geom
   - #1708, improve restore of PosgreSQL 9.1 backups 
   - #1766, don't let ST_RemEdge* destroy peripheral TopoGeometry objects.
   - #1714, more robust handling of high topology tolerance.
index fdf0c9f1403cf1ce9dcfb4e31634a2b32a295b12..149ea926c3f68c0982ecb9842c8da020c6461d4d 100644 (file)
@@ -583,9 +583,9 @@ lwgeom_symdifference(const LWGEOM* geom1, const LWGEOM* geom2)
        if ( lwgeom_is_empty(geom2) )
                return lwgeom_clone(geom1);
 
-       /* Empty.DymDifference(B) == Empty */
+       /* Empty.DymDifference(B) == B */
        if ( lwgeom_is_empty(geom1) )
-               return lwgeom_clone(geom1);
+               return lwgeom_clone(geom2);
 
        /* ensure srids are identical */
        srid = (int)(geom1->srid);
index eaa133e8978f93471a5896382b73de3a5c569248..75b4356fa27c54318fe2f4cdf9197c12f4c3a22c 100644 (file)
@@ -657,5 +657,13 @@ DROP table eg;
 -- #1755 --
 select '#1755', st_geographyFromText('SRID=4326;Point(85 35 0)');
 
+-- #1776 --
+with inp as ( SELECT 
+ 'POLYGON EMPTY'::geometry as A,
+ 'POLYGON((0 0, 10 0, 10 10, 0 0))'::geometry as B )
+SELECT '#1776',
+ ST_AsText(ST_SymDifference(A,B)), ST_AsText(ST_SymDifference(B, A))
+FROM inp;
+
 -- Clean up
 DELETE FROM spatial_ref_sys;
index bab85102fadfa80598406f32e445c0a0950fd95b..cb13d9acb14a358984ae851bede13388839e8994 100644 (file)
@@ -215,3 +215,4 @@ NOTICE:  SRID value -1 converted to the officially unknown SRID value 0
 #1697.3|1024
 #1734.1|1026
 #1755|01010000A0E6100000000000000040554000000000008041400000000000000000
+#1776|POLYGON((0 0,10 0,10 10,0 0))|POLYGON((0 0,10 0,10 10,0 0))