问题
The following query seems to be working just fine under MySQL 5.6 (returns 0 for the Area), but on MySQL 5.7 it returns an error saying ERROR 3037 (22023): Invalid GIS data provided to function st_area.
.
SELECT ST_Area(GeomFromText('POLYGON((0 0, 0 0, 0 0, 0 0, 0 0))'))
Is it possible to either ignore the error and return zero, or create a query to filter any such geometries from the query before running it?
A very simple schema and query example would be:
CREATE TABLE `polygons` (`id` int, `geom` GEOMETRY);
INSERT INTO `polygons` VALUES (1, GeomFromText('POLYGON((0 0, 0 0, 0 0, 0 0, 0 0))'));
SELECT `id`, ST_Area(`geom`) FROM `polygons`;
来源:https://stackoverflow.com/questions/34511741/mysql-5-7-invalid-gis-data