diff --git a/mysql-test/main/spatial_utility_function_isvalid.result b/mysql-test/main/spatial_utility_function_isvalid.result index f757ec9c1aa..67f3faa57d1 100644 --- a/mysql-test/main/spatial_utility_function_isvalid.result +++ b/mysql-test/main/spatial_utility_function_isvalid.result @@ -397,3 +397,10 @@ SELECT ST_ISVALID(ST_GEOMFROMTEXT('POLYGON((-200 0,-207.99999999999997 135.36742435621204,-208 1,-208 0,-208 -276.9111154485375,-200 0))')) c; c 1 +# +# MDEV-35103 CREATE TABLE AS SELECT ST_VALIDATE creates a column with datatype point, not geometry +# +create or replace table tb1 as SELECT st_validate(POINTFROMTEXT(' POINT( 4 1 ) ')) a; +create or replace table tb1 as SELECT st_validate(ST_GeomFromText (' linestring( 4 1,4 4 ) ')) a; +create table tb2 as SELECT (st_validate (ST_collect(( POINTFROMTEXT(' POINT( 4 1 ) ') )) )) a; +drop table tb1, tb2; diff --git a/mysql-test/main/spatial_utility_function_isvalid.test b/mysql-test/main/spatial_utility_function_isvalid.test index 3a14b2ec7f8..9df1050e40d 100644 --- a/mysql-test/main/spatial_utility_function_isvalid.test +++ b/mysql-test/main/spatial_utility_function_isvalid.test @@ -379,3 +379,11 @@ SELECT ST_ISVALID(ST_GEOMFROMTEXT('POLYGON((72.8714768817168 SELECT ST_ISVALID(ST_GEOMFROMTEXT('POLYGON((-200 0,-207.99999999999997 135.36742435621204,-208 1,-208 0,-208 -276.9111154485375,-200 0))')) c; + +--echo # +--echo # MDEV-35103 CREATE TABLE AS SELECT ST_VALIDATE creates a column with datatype point, not geometry +--echo # +create or replace table tb1 as SELECT st_validate(POINTFROMTEXT(' POINT( 4 1 ) ')) a; +create or replace table tb1 as SELECT st_validate(ST_GeomFromText (' linestring( 4 1,4 4 ) ')) a; +create table tb2 as SELECT (st_validate (ST_collect(( POINTFROMTEXT(' POINT( 4 1 ) ') )) )) a; +drop table tb1, tb2; diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index c2570ee2a01..0201f19f96b 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -1058,7 +1058,7 @@ public: String *val_str(String *) override; const Type_handler *type_handler() const override { - return &type_handler_point; + return &type_handler_geometry; } Item *do_get_copy(THD *thd) const override { return get_item_copy(thd, this); }