Bug #96963 gis function incompatible between 5.6 vs 8.0
Submitted: 22 Sep 14:51 Modified: 23 Sep 16:43
Reporter: andy zhang Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: GIS Severity:S3 (Non-critical)
Version:8.0, 5.7.27, 8.0.17 OS:Any
Assigned to: CPU Architecture:Any
Tags: gis spatial

[22 Sep 14:51] andy zhang
Description:
MySQL 8.0 spatial function differs from 5.6 on multiple polygons.
In 5.6, polygon type can be input to a defined multiple polygon type, while in 8.0. an error will be thrown.

How to repeat:
CREATE TABLE gis_multi_polygon  (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOLYGON);

In 8.0.13, 
insert into gis_multi_polygon values ( 120, ST_MPolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'));
ERROR 3516 (22S01): WKT value is a geometry of unexpected type POLYGON in st_mpolyfromtext.

While in 5.6

insert into gis_multi_polygon values ( 120,  PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'));
Query OK, 1 row affected (0.01 sec)
[22 Sep 15:15] Umesh Shastry
Hello andy zhang,

Thank you for the report.

regards,
Umesh
[23 Sep 7:44] Norvald Ryeng
Posted by developer:
 
Confirmed bug in 5.6: Type checking is failing, and the server allows polygons to be stored in multipolygon columns.

The problem is fixed in 5.7 and newer.
[23 Sep 16:43] andy zhang
Is it possible to let mysql 5.7 and 8.0 to behave like 5.6's. Some legacy application or data needs to allow the "failure". Can you provide a new sql option or variable.