Bug #43493 union function returns polygon not multipolygon for non-intersecting polygons
Submitted: 9 Mar 2009 9:52 Modified: 7 Aug 2012 12:28
Reporter: John Powell Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: GIS Severity:S3 (Non-critical)
Version:5.1 WL#1326 OS:Linux
Assigned to: Assigned Account CPU Architecture:Any
Tags: gis, multipolygon, polygon, union function

[9 Mar 2009 9:52] John Powell
Description:
The union function performed on two non-intersection polygons returns a polygon and not a multipolygon. A polygon is defined as a single outer ring, with any number of inner rings. A multipolygon is defined as any number of non-intersecting polygons.

How to repeat:
create two non-intersection polygons

mysql>set @geom=geomfromtext('POLYGON((0 0, 10 0, 0 10, 0 0))');
mysql>set @geom1=geomfromtext('POLYGON((100 100, 110 100, 100 110, 100 100))');

create new geometry, the union of these two:

mysql>set @union=union(@geom, @geom1);

select result

mysql> select astext(@union);
+----------------------------------------------------------------+
| astext(@union)                                                 |
+----------------------------------------------------------------+
| POLYGON((0 0,0 10,10 0,0 0),(100 100,100 110,110 100,100 100)) | 
+----------------------------------------------------------------+

The result should be MULTIPOLYGON(((0 0,0 10,10 0,0 0)),((100 100,100 110,110 100,100 100)))
[10 Mar 2009 8:59] Sveta Smirnova
Thank you for the report.

Verified as described.
[7 May 2009 12:01] John Powell
Confirmed fixed. Thanks for the quick resolution.
[7 Aug 2012 12:28] Alexander Barkov
This bug was earlier fixed in mysql-gis tree (before mysql-5.6 release).