Skip to content

Commit 79a1fdd

Browse files
MDEV-35103 CREATE TABLE AS SELECT ST_VALIDATE creates a column with datatype point, not geometry
Changes the type handler for geometry validate from 'point' to 'geometry'
1 parent 8c2a207 commit 79a1fdd

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

mysql-test/main/spatial_utility_function_isvalid.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,3 +397,10 @@ SELECT ST_ISVALID(ST_GEOMFROMTEXT('POLYGON((-200 0,-207.99999999999997
397397
135.36742435621204,-208 1,-208 0,-208 -276.9111154485375,-200 0))')) c;
398398
c
399399
1
400+
#
401+
# MDEV-35103 CREATE TABLE AS SELECT ST_VALIDATE creates a column with datatype point, not geometry
402+
#
403+
create or replace table tb1 as SELECT st_validate(POINTFROMTEXT(' POINT( 4 1 ) ')) a;
404+
create or replace table tb1 as SELECT st_validate(ST_GeomFromText (' linestring( 4 1,4 4 ) ')) a;
405+
create table tb2 as SELECT (st_validate (ST_collect(( POINTFROMTEXT(' POINT( 4 1 ) ') )) )) a;
406+
drop table tb1, tb2;

mysql-test/main/spatial_utility_function_isvalid.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,3 +379,11 @@ SELECT ST_ISVALID(ST_GEOMFROMTEXT('POLYGON((72.8714768817168
379379

380380
SELECT ST_ISVALID(ST_GEOMFROMTEXT('POLYGON((-200 0,-207.99999999999997
381381
135.36742435621204,-208 1,-208 0,-208 -276.9111154485375,-200 0))')) c;
382+
383+
--echo #
384+
--echo # MDEV-35103 CREATE TABLE AS SELECT ST_VALIDATE creates a column with datatype point, not geometry
385+
--echo #
386+
create or replace table tb1 as SELECT st_validate(POINTFROMTEXT(' POINT( 4 1 ) ')) a;
387+
create or replace table tb1 as SELECT st_validate(ST_GeomFromText (' linestring( 4 1,4 4 ) ')) a;
388+
create table tb2 as SELECT (st_validate (ST_collect(( POINTFROMTEXT(' POINT( 4 1 ) ') )) )) a;
389+
drop table tb1, tb2;

sql/item_geofunc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ class Item_func_validate: public Item_geometry_func_args_geometry
10581058
String *val_str(String *) override;
10591059
const Type_handler *type_handler() const override
10601060
{
1061-
return &type_handler_point;
1061+
return &type_handler_geometry;
10621062
}
10631063
Item *do_get_copy(THD *thd) const override
10641064
{ return get_item_copy<Item_func_validate>(thd, this); }

0 commit comments

Comments
 (0)