commit 7e35d8e06606e008db429e1ff2235feef66d6639 Author: songhuaxiong.shx Date: Mon Dec 12 11:03:43 2022 +0800 [Bug#109217] Make insert...select...between different geometry types fail Problem ======= When insert spatial datas into column whose type is spatial data and different with insert one, error will happen.However, "INSERT INTO ... SELECT" can be successful unexpectedly! At the same time, as long as there is an master-slave relationship, the data in the slave will be different with the master one. Solution ======== Add logic to judge type "MYSQL_TYPE_GEOMETRY", so that "field_conv()" will call "Field_geom::store" eventually instead of returning [TYPE_OK] directly. Because the query can not be executed in master, data in slave will be consistent naturally with master one. diff --git a/mysql-test/r/gis_insert_select.result b/mysql-test/r/gis_insert_select.result new file mode 100644 index 00000000000..784cd3baec2 --- /dev/null +++ b/mysql-test/r/gis_insert_select.result @@ -0,0 +1,119 @@ +# Create table and insert value. +USE test; +CREATE TABLE t_point(a POINT); +CREATE TABLE t_linestring(a LINESTRING); +CREATE TABLE t_polygon(a POLYGON); +CREATE TABLE t_geometry(a GEOMETRY); +CREATE TABLE t_multipoint(a MULTIPOINT); +CREATE TABLE t_multilinestring(a MULTILINESTRING); +CREATE TABLE t_multipolygon(a MULTIPOLYGON); +CREATE TABLE t_geometrycollection(a GEOMETRYCOLLECTION); +INSERT INTO `t_point` (a) VALUES (ST_GEOMFROMTEXT('POINT(0 0)')); +INSERT INTO `t_linestring` (a) VALUES (ST_GEOMFROMTEXT('LINESTRING(10 10, 20 20)')); +INSERT INTO `t_polygon` (a) VALUES (ST_GEOMFROMTEXT('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))')); +INSERT INTO `t_geometry` (a) VALUES (ST_GeomFromText('GEOMETRYCOLLECTION(POINT(10 10), POINT(30 30), POINT(50 50), LINESTRING(15 15, 20 20))')); +INSERT INTO `t_multipoint` VALUES (ST_GeomFromText('MULTIPOINT(0 0, 20 20, 60 60)')); +INSERT INTO `t_multilinestring` VALUES (ST_GeomFromText('MULTILINESTRING((10 10, 20 20), (15 15, 30 15))')); +INSERT INTO `t_multipolygon` VALUES (ST_GeomFromText('MULTIPOLYGON(((0 0, 10 0, 10 10, 0 10, 0 0)), ((5 5, 7 5, 7 7, 5 7, 5 5)))')); +INSERT INTO `t_geometrycollection` VALUES (ST_GeomFromText('GEOMETRYCOLLECTION(POINT(10 10), POINT(30 30), LINESTRING(15 15, 20 20))')); + +# Do "INSERT...SELECT..." +INSERT INTO `t_point` SELECT * FROM t_linestring; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_point` SELECT * FROM t_polygon; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_point` SELECT * FROM t_geometry; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_point` SELECT * FROM t_multipoint; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_point` SELECT * FROM t_multilinestring; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_point` SELECT * FROM t_multipolygon; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_point` SELECT * FROM t_geometrycollection; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field + +INSERT INTO `t_linestring` SELECT * FROM t_point; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_linestring` SELECT * FROM t_polygon; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_linestring` SELECT * FROM t_geometry; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_linestring` SELECT * FROM t_multipoint; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_linestring` SELECT * FROM t_multilinestring; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_linestring` SELECT * FROM t_multipolygon; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_linestring` SELECT * FROM t_geometrycollection; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field + +INSERT INTO `t_polygon` SELECT * FROM t_point; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_polygon` SELECT * FROM t_linestring; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_polygon` SELECT * FROM t_geometry; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_polygon` SELECT * FROM t_multipoint; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_polygon` SELECT * FROM t_multilinestring; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_polygon` SELECT * FROM t_multipolygon; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_polygon` SELECT * FROM t_geometrycollection; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field + +INSERT INTO `t_multipoint` SELECT * FROM t_point; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_multipoint` SELECT * FROM t_linestring; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_multipoint` SELECT * FROM t_polygon; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_multipoint` SELECT * FROM t_geometry; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_multipoint` SELECT * FROM t_multilinestring; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_multipoint` SELECT * FROM t_multipolygon; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_multipoint` SELECT * FROM t_geometrycollection; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field + +INSERT INTO `t_multilinestring` SELECT * FROM t_point; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_multilinestring` SELECT * FROM t_linestring; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_multilinestring` SELECT * FROM t_polygon; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_multilinestring` SELECT * FROM t_geometry; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_multilinestring` SELECT * FROM t_multipoint; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_multilinestring` SELECT * FROM t_multipolygon; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_multilinestring` SELECT * FROM t_geometrycollection; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field + +INSERT INTO `t_multipolygon` SELECT * FROM t_point; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_multipolygon` SELECT * FROM t_linestring; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_multipolygon` SELECT * FROM t_polygon; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_multipolygon` SELECT * FROM t_geometry; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_multipolygon` SELECT * FROM t_multipoint; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_multipolygon` SELECT * FROM t_multilinestring; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +INSERT INTO `t_multipolygon` SELECT * FROM t_geometrycollection; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field + +# Drop tables. +DROP TABLE t_point; +DROP TABLE t_linestring; +DROP TABLE t_polygon; +DROP TABLE t_geometry; +DROP TABLE t_multipoint; +DROP TABLE t_multilinestring; +DROP TABLE t_multipolygon; +DROP TABLE t_geometrycollection; diff --git a/mysql-test/suite/gis/r/geometry_property_functions.result b/mysql-test/suite/gis/r/geometry_property_functions.result index 147dd29506b..2a1629fcc5e 100644 --- a/mysql-test/suite/gis/r/geometry_property_functions.result +++ b/mysql-test/suite/gis/r/geometry_property_functions.result @@ -1825,6 +1825,7 @@ SET New.g = ST_POINTFROMTEXT('POINT(-1e308 1e308)'); END| # Calling the trigger UPDATE gis_point SET fid = 999 WHERE fid = 111; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field # Checking the table entries SELECT fid, ST_ASTEXT(g) FROM gis_point; fid ST_ASTEXT(g) @@ -1838,28 +1839,13 @@ fid ST_ASTEXT(g) 108 POINT(0 10) 109 POINT(-10 0) 110 POINT(0 -10) +111 POINT(1 1) 112 POINT(1e308 1e308) 113 POINT(1e308 -1e308) 114 POINT(-1e308 1e308) 115 POINT(-1e308 -1e308) -999 POINT(-1e308 1e308) SELECT fid, ST_ASTEXT(g) FROM gis_multi_point; fid ST_ASTEXT(g) -101 POINT(0 0) -102 POINT(1 0) -103 POINT(0 1) -104 POINT(1 1) -105 POINT(-1 1) -106 POINT(0 0) -107 POINT(10 0) -108 POINT(0 10) -109 POINT(-10 0) -110 POINT(0 -10) -111 POINT(1 1) -112 POINT(1e308 1e308) -113 POINT(1e308 -1e308) -114 POINT(-1e308 1e308) -115 POINT(-1e308 -1e308) 401 MULTIPOINT((0 0)) 402 MULTIPOINT((0 0),(2 2),(4 4)) 403 MULTIPOINT((0 0),(5 5),(10 10)) @@ -1887,6 +1873,7 @@ SET New.g = ST_LINEFROMTEXT('LINESTRING(0 0,10 0,0 0,0 10,0 0,-10 0,0 0,0 10,0 0 END| # Calling the trigger UPDATE gis_linestring SET fid = 999 WHERE fid = 211; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field # Checking the table entries SELECT fid, ST_ASTEXT(g) FROM gis_linestring; fid ST_ASTEXT(g) @@ -1900,28 +1887,13 @@ fid ST_ASTEXT(g) 208 LINESTRING(0 0,-5 -5,-10 10) 209 LINESTRING(0 0,2 2,4 4,6 6,8 8) 210 LINESTRING(0 0,5 5) +211 LINESTRING(0 0,-50 -50,10 -10) 212 LINESTRING(0 0,1e308 1e308,1e308 -1e308) 213 LINESTRING(1e308 1e308,1e308 -1e308) 214 LINESTRING(1 1,2 2,3 3,4 4,5 5,6 6,7 7,8 8,9 9) 215 LINESTRING(10 10,10 -10,-10 -10,-10 10,10 10) -999 LINESTRING(0 0,10 0,0 0,0 10,0 0,-10 0,0 0,0 10,0 0) SELECT fid, ST_ASTEXT(g) FROM gis_multi_linestring; fid ST_ASTEXT(g) -201 LINESTRING(0 0,5 5) -202 LINESTRING(0 0,2 2,4 4) -203 LINESTRING(0 0,5 5,10 10) -204 LINESTRING(10 10,5 5) -205 LINESTRING(0 0,12 12,24 24) -206 LINESTRING(0 0,50 50,100 100) -207 LINESTRING(0 0,5 5) -208 LINESTRING(0 0,-5 -5,-10 10) -209 LINESTRING(0 0,2 2,4 4,6 6,8 8) -210 LINESTRING(0 0,5 5) -211 LINESTRING(0 0,-50 -50,10 -10) -212 LINESTRING(0 0,1e308 1e308,1e308 -1e308) -213 LINESTRING(1e308 1e308,1e308 -1e308) -214 LINESTRING(1 1,2 2,3 3,4 4,5 5,6 6,7 7,8 8,9 9) -215 LINESTRING(10 10,10 -10,-10 -10,-10 10,10 10) 501 MULTILINESTRING((0 0,2 2)) 502 MULTILINESTRING((0 0,2 2,4 4)) 503 MULTILINESTRING((0 0,2 2,4 4),(6 6,8 8,10 10)) @@ -1949,6 +1921,7 @@ SET New.g = ST_POLYFROMTEXT('POLYGON((0 0,10 0,10 10,0 10,0 0),(3 3,3 7,7 7,7 3, END| # Calling the trigger UPDATE gis_polygon SET fid = 999 WHERE fid = 311; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field # Checking the table entries SELECT fid, ST_ASTEXT(g) FROM gis_polygon; fid ST_ASTEXT(g) @@ -1962,28 +1935,13 @@ fid ST_ASTEXT(g) 308 POLYGON((0 0,0 15,15 15,15 0,0 0)) 309 POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)) 310 POLYGON((0 0,0 5,5 5,0 0)) +311 POLYGON((10 10,10 15,15 15,15 10,10 10)) 312 POLYGON((10 10,10 20,20 20,20 10,10 10),(14 14,14 16,16 16,16 14,14 14)) 313 POLYGON((0 0,0 10,10 10,10 0,5 5,0 0)) 314 POLYGON((10 0,10 10,0 10,-10 10,-10 0,-10 -10,0 10,10 -10,10 0)) 315 POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,2 4,4 4,4 2,2 2),(6 6,6 8,8 8,8 6,6 6)) -999 POLYGON((0 0,10 0,10 10,0 10,0 0),(3 3,3 7,7 7,7 3,3 3)) SELECT fid, ST_ASTEXT(g) FROM gis_multi_polygon; fid ST_ASTEXT(g) -301 POLYGON((0 0,0 5,5 5,0 0)) -302 POLYGON((0 0,0 5,5 5,5 0,0 0)) -303 POLYGON((0 0,0 10,10 10,10 0,0 0)) -304 POLYGON((0 0,0 50,50 50,50 0,0 0)) -305 POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)) -306 POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,2 4,4 4,4 2,2 2),(6 6,6 8,8 8,8 6,6 6)) -307 POLYGON((0 0,0 5,5 5,0 0)) -308 POLYGON((0 0,0 15,15 15,15 0,0 0)) -309 POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)) -310 POLYGON((0 0,0 5,5 5,0 0)) -311 POLYGON((10 10,10 15,15 15,15 10,10 10)) -312 POLYGON((10 10,10 20,20 20,20 10,10 10),(14 14,14 16,16 16,16 14,14 14)) -313 POLYGON((0 0,0 10,10 10,10 0,5 5,0 0)) -314 POLYGON((10 0,10 10,0 10,-10 10,-10 0,-10 -10,0 10,10 -10,10 0)) -315 POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,2 4,4 4,4 2,2 2),(6 6,6 8,8 8,8 6,6 6)) 601 MULTIPOLYGON(((0 0,0 5,5 5,0 0))) 602 MULTIPOLYGON(((0 0,0 5,5 5,0 0)),((5 5,5 10,10 10,5 5))) 603 MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))) diff --git a/mysql-test/suite/gis/t/geometry_property_functions.test b/mysql-test/suite/gis/t/geometry_property_functions.test index 7f53aedf51d..953a2311e93 100644 --- a/mysql-test/suite/gis/t/geometry_property_functions.test +++ b/mysql-test/suite/gis/t/geometry_property_functions.test @@ -1639,6 +1639,7 @@ END| DELIMITER ;| --echo # Calling the trigger +--error 1416 UPDATE gis_point SET fid = 999 WHERE fid = 111; --echo # Checking the table entries @@ -1666,6 +1667,7 @@ END| DELIMITER ;| --echo # Calling the trigger +--error 1416 UPDATE gis_linestring SET fid = 999 WHERE fid = 211; --echo # Checking the table entries @@ -1693,6 +1695,7 @@ END| DELIMITER ;| --echo # Calling the trigger +--error 1416 UPDATE gis_polygon SET fid = 999 WHERE fid = 311; --echo # Checking the table entries diff --git a/mysql-test/t/gis_insert_select.test b/mysql-test/t/gis_insert_select.test new file mode 100644 index 00000000000..adc774108ef --- /dev/null +++ b/mysql-test/t/gis_insert_select.test @@ -0,0 +1,140 @@ +# [Bug#109217] Make insert...select...between different geometry types fail. +# When insert spatial datas into column whose type is spatial data and different +# with insert one, error will happen.However, "INSERT INTO ... SELECT" can be +# successful unexpectedly! At the same time, as long as there is an master-slave +# relationship, the data in the standby database will be inconsistent with the +# main database. + +# 1) Create gis table and insert data. +--echo # Create table and insert value. +USE test; +CREATE TABLE t_point(a POINT); +CREATE TABLE t_linestring(a LINESTRING); +CREATE TABLE t_polygon(a POLYGON); +CREATE TABLE t_geometry(a GEOMETRY); +CREATE TABLE t_multipoint(a MULTIPOINT); +CREATE TABLE t_multilinestring(a MULTILINESTRING); +CREATE TABLE t_multipolygon(a MULTIPOLYGON); +CREATE TABLE t_geometrycollection(a GEOMETRYCOLLECTION); + +INSERT INTO `t_point` (a) VALUES (ST_GEOMFROMTEXT('POINT(0 0)')); +INSERT INTO `t_linestring` (a) VALUES (ST_GEOMFROMTEXT('LINESTRING(10 10, 20 20)')); +INSERT INTO `t_polygon` (a) VALUES (ST_GEOMFROMTEXT('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))')); +INSERT INTO `t_geometry` (a) VALUES (ST_GeomFromText('GEOMETRYCOLLECTION(POINT(10 10), POINT(30 30), POINT(50 50), LINESTRING(15 15, 20 20))')); +INSERT INTO `t_multipoint` VALUES (ST_GeomFromText('MULTIPOINT(0 0, 20 20, 60 60)')); +INSERT INTO `t_multilinestring` VALUES (ST_GeomFromText('MULTILINESTRING((10 10, 20 20), (15 15, 30 15))')); +INSERT INTO `t_multipolygon` VALUES (ST_GeomFromText('MULTIPOLYGON(((0 0, 10 0, 10 10, 0 10, 0 0)), ((5 5, 7 5, 7 7, 5 7, 5 5)))')); +INSERT INTO `t_geometrycollection` VALUES (ST_GeomFromText('GEOMETRYCOLLECTION(POINT(10 10), POINT(30 30), LINESTRING(15 15, 20 20))')); + + +# 2) Insert select +--echo +--echo # Do "INSERT...SELECT..." +--error 1416 +INSERT INTO `t_point` SELECT * FROM t_linestring; +--error 1416 +INSERT INTO `t_point` SELECT * FROM t_polygon; +--error 1416 +INSERT INTO `t_point` SELECT * FROM t_geometry; +--error 1416 +INSERT INTO `t_point` SELECT * FROM t_multipoint; +--error 1416 +INSERT INTO `t_point` SELECT * FROM t_multilinestring; +--error 1416 +INSERT INTO `t_point` SELECT * FROM t_multipolygon; +--error 1416 +INSERT INTO `t_point` SELECT * FROM t_geometrycollection; + +--echo +--error 1416 +INSERT INTO `t_linestring` SELECT * FROM t_point; +--error 1416 +INSERT INTO `t_linestring` SELECT * FROM t_polygon; +--error 1416 +INSERT INTO `t_linestring` SELECT * FROM t_geometry; +--error 1416 +INSERT INTO `t_linestring` SELECT * FROM t_multipoint; +--error 1416 +INSERT INTO `t_linestring` SELECT * FROM t_multilinestring; +--error 1416 +INSERT INTO `t_linestring` SELECT * FROM t_multipolygon; +--error 1416 +INSERT INTO `t_linestring` SELECT * FROM t_geometrycollection; + +--echo +--error 1416 +INSERT INTO `t_polygon` SELECT * FROM t_point; +--error 1416 +INSERT INTO `t_polygon` SELECT * FROM t_linestring; +--error 1416 +INSERT INTO `t_polygon` SELECT * FROM t_geometry; +--error 1416 +INSERT INTO `t_polygon` SELECT * FROM t_multipoint; +--error 1416 +INSERT INTO `t_polygon` SELECT * FROM t_multilinestring; +--error 1416 +INSERT INTO `t_polygon` SELECT * FROM t_multipolygon; +--error 1416 +INSERT INTO `t_polygon` SELECT * FROM t_geometrycollection; + +--echo +--error 1416 +INSERT INTO `t_multipoint` SELECT * FROM t_point; +--error 1416 +INSERT INTO `t_multipoint` SELECT * FROM t_linestring; +--error 1416 +INSERT INTO `t_multipoint` SELECT * FROM t_polygon; +--error 1416 +INSERT INTO `t_multipoint` SELECT * FROM t_geometry; +--error 1416 +INSERT INTO `t_multipoint` SELECT * FROM t_multilinestring; +--error 1416 +INSERT INTO `t_multipoint` SELECT * FROM t_multipolygon; +--error 1416 +INSERT INTO `t_multipoint` SELECT * FROM t_geometrycollection; + +--echo +--error 1416 +INSERT INTO `t_multilinestring` SELECT * FROM t_point; +--error 1416 +INSERT INTO `t_multilinestring` SELECT * FROM t_linestring; +--error 1416 +INSERT INTO `t_multilinestring` SELECT * FROM t_polygon; +--error 1416 +INSERT INTO `t_multilinestring` SELECT * FROM t_geometry; +--error 1416 +INSERT INTO `t_multilinestring` SELECT * FROM t_multipoint; +--error 1416 +INSERT INTO `t_multilinestring` SELECT * FROM t_multipolygon; +--error 1416 +INSERT INTO `t_multilinestring` SELECT * FROM t_geometrycollection; + +--echo +--error 1416 +INSERT INTO `t_multipolygon` SELECT * FROM t_point; +--error 1416 +INSERT INTO `t_multipolygon` SELECT * FROM t_linestring; +--error 1416 +INSERT INTO `t_multipolygon` SELECT * FROM t_polygon; +--error 1416 +INSERT INTO `t_multipolygon` SELECT * FROM t_geometry; +--error 1416 +INSERT INTO `t_multipolygon` SELECT * FROM t_multipoint; +--error 1416 +INSERT INTO `t_multipolygon` SELECT * FROM t_multilinestring; +--error 1416 +INSERT INTO `t_multipolygon` SELECT * FROM t_geometrycollection; + + +# 3) Clean up +--echo +--echo # Drop tables. +DROP TABLE t_point; +DROP TABLE t_linestring; +DROP TABLE t_polygon; +DROP TABLE t_geometry; +DROP TABLE t_multipoint; +DROP TABLE t_multilinestring; +DROP TABLE t_multipolygon; +DROP TABLE t_geometrycollection; diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 5f59aa19014..221608d9ec1 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -980,7 +980,8 @@ type_conversion_status field_conv(Field *to,Field *from) to->type() != MYSQL_TYPE_DATETIME && (!to->table->in_use->variables.explicit_defaults_for_timestamp || to->type() != MYSQL_TYPE_TIMESTAMP))) && - (from->real_type() != MYSQL_TYPE_VARCHAR)) + (from->real_type() != MYSQL_TYPE_VARCHAR) && + to->real_type() != MYSQL_TYPE_GEOMETRY) { // Identical fields // to->ptr==from->ptr may happen if one does 'UPDATE ... SET x=x' memmove(to->ptr, from->ptr, to->pack_length());