diff options
author | Alexander Barkov <bar@mariadb.org> | 2017-05-29 10:29:46 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2017-05-29 10:29:46 +0400 |
commit | 8b68263a531bf6926afea71fe6eaf2ffd5a85049 (patch) | |
tree | 18f856a87aa714ddc48e292c0bded53faf95e08c /mysql-test/t/gis.test | |
parent | 0f0bced885d6a6e6e494f227ac36419dd7bd3f80 (diff) | |
download | mariadb-git-8b68263a531bf6926afea71fe6eaf2ffd5a85049.tar.gz |
MDEV-12803 Improve function parameter data type control
Diffstat (limited to 'mysql-test/t/gis.test')
-rw-r--r-- | mysql-test/t/gis.test | 344 |
1 files changed, 340 insertions, 4 deletions
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index 05ec751e686..05f455e6186 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -706,7 +706,7 @@ drop table t1; # Bug#44684: valgrind reports invalid reads in # Item_func_spatial_collection::val_str # ---error ER_ILLEGAL_VALUE_FOR_TYPE +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION SELECT MultiPoint(12345,''); #SELECT MultiPoint(123451,''); #SELECT MultiPoint(1234512,''); @@ -733,7 +733,7 @@ SELECT MultiPoint(12345,''); # # Bug55531 crash with conversions of geometry types / strings # ---error ER_ILLEGAL_VALUE_FOR_TYPE +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUAL) AS d WHERE (LINESTRING(d.b)); @@ -826,7 +826,7 @@ SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))); --echo # GEOMETRY FUNCTION ARGUMENTS --echo # --replace_regex /non geometric .* value/non geometric '' value/ ---error ER_ILLEGAL_VALUE_FOR_TYPE +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION SELECT GEOMETRYCOLLECTION((SELECT @@OLD)); --echo # @@ -1373,6 +1373,7 @@ create table t1(a geometry not null)engine=myisam; insert into t1 values(geomfromtext("POINT(0 0)")); insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)")); insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)")); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION select equals(`a`,convert(`a` using utf8)) from `t1`; select equals(`a`,left(`a`,23)) from `t1`; drop table t1; @@ -2318,7 +2319,6 @@ EXECUTE stmt USING POINT(1,1); SHOW CREATE TABLE t1; DROP TABLE t1; - --echo # --echo # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions --echo # @@ -2339,5 +2339,341 @@ SELECT --echo # +--echo # MDEV-12803 Improve function parameter data type control +--echo # + +--echo # +--echo # Item_geometry_func_args_geometry +--echo # + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_CENTROID(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ENVELOPE(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_BOUNDARY(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_STARTPOINT(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_POINTONSURFACE(1); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_POINTN(1,1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_POINTN(LineString(Point(1,1)),Point(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_BUFFER(1, 1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_BUFFER(Point(1,1), Point(1,1)); + + +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_ENVELOPE(?) AS g'; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +EXECUTE stmt USING 1; +EXECUTE stmt USING POINT(1,1); +SHOW CREATE TABLE t1; +SELECT ST_ASTEXT(g) FROM t1; +DROP TABLE t1; +DEALLOCATE PREPARE stmt; + +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_BUFFER(?,?) AS g'; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +EXECUTE stmt USING 1,1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +EXECUTE stmt USING POINT(1,1),POINT(1,1); +EXECUTE stmt USING POINT(1,1),0; +SHOW CREATE TABLE t1; +SELECT ST_GEOMETRYTYPE(g) FROM t1; +DROP TABLE t1; +DEALLOCATE PREPARE stmt; + +--echo # +--echo # Functions created GEOMETRY from non-GEOMETRY +--echo # + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYFROMTEXT(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYFROMTEXT(Point(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYFROMTEXT(Point(1,1), 1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYFROMTEXT('test', Point(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYFROMWKB(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYFROMWKB(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYFROMWKB(1, 1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYFROMWKB(Point(1,1), Point(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMFROMGEOJSON(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMFROMGEOJSON(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMFROMGEOJSON(1,1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMFROMGEOJSON(Point(1,1), Point(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT POINT(ROW(1,1),1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT POINT(POINT(1,1),1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT POINT(1,ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT POINT(1,POINT(1,1)); + + +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_GEOMFROMTEXT(?,?) AS g'; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +EXECUTE stmt USING 1,1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +EXECUTE stmt USING POINT(1,1),POINT(1,1); +EXECUTE stmt USING 'POINT(1 1)',1; +SHOW CREATE TABLE t1; +SELECT ST_ASTEXT(g), SRID(g) FROM t1; +DROP TABLE t1; +DEALLOCATE PREPARE stmt; + + + +--echo # Item_func_spatial_collection + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT GEOMETRYCOLLECTION(ROW(1,1), POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT GEOMETRYCOLLECTION(POINT(1,1), ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT GEOMETRYCOLLECTION(1, POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT GEOMETRYCOLLECTION(POINT(1,1), 1); + +--echo # Item_func_spatial_operation + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_UNION(ROW(1,1), POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_UNION(POINT(1,1), ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_UNION(1, POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_UNION(POINT(1,1), 1); + +--echo # Item_binary_func_args_geometry + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASWKB(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASWKB(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASWKB('test'); + + +--echo # Item_real_func_args_geometry + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_X(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_X(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_X('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_Y(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_Y(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_Y('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_AREA(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_AREA(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_AREA('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_LENGTH(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_LENGTH(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_LENGTH('test'); + + +--echo # Item_real_func_geometry_args_geometry_geometry + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_DISTANCE(ROW(1,1), 1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_DISTANCE(1, 1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_DISTANCE('test', 1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_DISTANCE(POINT(1,1), ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_DISTANCE(POINT(1,1), 1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_DISTANCE(POINT(1,1), 'test'); + + +--echo # Item_int_func_args_geometry + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISSIMPLE(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISSIMPLE(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISSIMPLE('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISRING(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISRING(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISRING('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISCLOSED(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISCLOSED(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISCLOSED('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_DIMENSION(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_DIMENSION(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_DIMENSION('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_NUMGEOMETRIES(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_NUMGEOMETRIES(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_NUMGEOMETRIES('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_NUMINTERIORRINGS(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_NUMINTERIORRINGS(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_NUMINTERIORRINGS('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_NUMPOINTS(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_NUMPOINTS(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_NUMPOINTS('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_SRID(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_SRID(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_SRID('test'); + + +--echo # Item_bool_func_args_geometry + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISEMPTY(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISEMPTY(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISEMPTY('test'); + +--echo # Item_bool_func_geometry_args_geometry_geometry + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(ROW(1,1), POINT(1,1), 'T*F**FFF*'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(POINT(1,1), ROW(1,1), 'T*F**FFF*'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(1, POINT(1,1), 'T*F**FFF*'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(POINT(1,1), 1, 'T*F**FFF*'); +SELECT ST_RELATE(Point(1,1),Point(1,1),'T*F**FFF*') AS equals; +SELECT ST_RELATE(Point(1,1),Point(1,1),NULL); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(Point(1,1),Point(1,1),ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(Point(1,1),Point(1,1),1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(Point(1,1),Point(1,1),1.0); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(Point(1,1),Point(1,1),1e0); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(Point(1,1),Point(1,1),TIME'10:10:10'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(Point(1,1),Point(1,1),DATE'2010-01-01'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(Point(1,1),Point(1,1),TIMESTAMP'2010-01-01 10:10:10'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(Point(1,1),Point(1,1),Point(1,1)); + + +--echo # Item_str_ascii_func_args_geometry + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASTEXT(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASTEXT(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASTEXT('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYTYPE(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYTYPE(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYTYPE('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASGEOJSON(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASGEOJSON(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASGEOJSON('test'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASGEOJSON(POINT(1,1), POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASGEOJSON(POINT(1,1), 1, POINT(1,1)); + +--echo # Item_func_spatial_rel + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_TOUCHES(ROW(1,1), POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_TOUCHES(POINT(1,1), ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_TOUCHES(1, POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_TOUCHES(POINT(1,1), 1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_TOUCHES('test', POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_TOUCHES(POINT(1,1), 'test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT MBRTOUCHES(ROW(1,1), POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT MBRTOUCHES(POINT(1,1), ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT MBRTOUCHES(1, POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT MBRTOUCHES(POINT(1,1), 1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT MBRTOUCHES('test', POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT MBRTOUCHES(POINT(1,1), 'test'); + +--echo # --echo # End of 10.3 tests --echo # |