diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2013-02-21 01:03:45 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@askmonty.org> | 2013-02-21 01:03:45 +0400 |
commit | ca29490102f02527a9b36b1300c8483dc98062dc (patch) | |
tree | 7d7c201fc1d0eb86e37021b1d05c3be17877a4c3 /mysql-test | |
parent | 2c37ace13164b0a261fd850a0d11f5af539e657a (diff) | |
download | mariadb-git-ca29490102f02527a9b36b1300c8483dc98062dc.tar.gz |
MDEV-3819 missing constraints for spatial column types.
Checks added to return and error when inappropriate
geometry type is stored in a field.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/gis-rtree.result | 4 | ||||
-rw-r--r-- | mysql-test/r/gis.result | 9 | ||||
-rw-r--r-- | mysql-test/t/gis-rtree.test | 4 | ||||
-rw-r--r-- | mysql-test/t/gis.test | 11 |
4 files changed, 22 insertions, 6 deletions
diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result index 26787366358..c394aec8851 100644 --- a/mysql-test/r/gis-rtree.result +++ b/mysql-test/r/gis-rtree.result @@ -758,7 +758,7 @@ SPATIAL KEY(g) INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 2, 2 3)')),(GeomFromText('LineString(1 2, 2 4)')); drop table t1; CREATE TABLE t1 ( -line LINESTRING NOT NULL, +line GEOMETRY NOT NULL, kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po', name VARCHAR(32), SPATIAL KEY (line) @@ -1553,7 +1553,7 @@ End of 5.0 tests. # Bug #57323/11764487: myisam corruption with insert ignore # and invalid spatial data # -CREATE TABLE t1(a LINESTRING NOT NULL, b GEOMETRY NOT NULL, +CREATE TABLE t1(a POINT NOT NULL, b GEOMETRY NOT NULL, SPATIAL KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM; INSERT INTO t1 VALUES(GEOMFROMTEXT("point (0 0)"), GEOMFROMTEXT("point (1 1)")); INSERT IGNORE INTO t1 SET a=GEOMFROMTEXT("point (-6 0)"), b=GEOMFROMTEXT("error"); diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 30385323502..9253270a79e 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -1047,7 +1047,7 @@ SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000 SET @a=POLYFROMWKB(@a); SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; SET @a=POLYFROMWKB(@a); -create table t1(a polygon NOT NULL)engine=myisam; +create table t1(a geometry NOT NULL)engine=myisam; insert into t1 values (geomfromtext("point(0 1)")); insert into t1 values (geomfromtext("point(1 0)")); select * from (select polygon(t1.a) as p from t1 order by t1.a) d; @@ -1491,4 +1491,11 @@ SELECT 1 FROM g1 WHERE a >= ANY (SELECT 1 FROM g1 WHERE a = geomfromtext('') OR a) ; 1 DROP TABLE g1; +# +# MDEV-3819 missing constraints for spatial column types +# +create table t1 (pt point); +insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))')); +ERROR 22007: Incorrect POINT value: 'POLYGON' for column 'pt' at row 1 +drop table t1; End of 5.5 tests diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test index e7e6fa59df0..731efe5648e 100644 --- a/mysql-test/t/gis-rtree.test +++ b/mysql-test/t/gis-rtree.test @@ -120,7 +120,7 @@ INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 2, 2 3)')),(GeomFromText(' drop table t1; CREATE TABLE t1 ( - line LINESTRING NOT NULL, + line GEOMETRY NOT NULL, kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po', name VARCHAR(32), @@ -935,7 +935,7 @@ DROP TABLE t1; --echo # and invalid spatial data --echo # -CREATE TABLE t1(a LINESTRING NOT NULL, b GEOMETRY NOT NULL, +CREATE TABLE t1(a POINT NOT NULL, b GEOMETRY NOT NULL, SPATIAL KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM; INSERT INTO t1 VALUES(GEOMFROMTEXT("point (0 0)"), GEOMFROMTEXT("point (1 1)")); --error ER_CANT_CREATE_GEOMETRY_OBJECT diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index b0ad8329cfb..188cba004df 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -741,7 +741,7 @@ SET @a=POLYFROMWKB(@a); # Bug #57321 crashes and valgrind errors from spatial types # -create table t1(a polygon NOT NULL)engine=myisam; +create table t1(a geometry NOT NULL)engine=myisam; insert into t1 values (geomfromtext("point(0 1)")); insert into t1 values (geomfromtext("point(1 0)")); select * from (select polygon(t1.a) as p from t1 order by t1.a) d; @@ -1358,4 +1358,13 @@ SELECT 1 FROM g1 WHERE a >= ANY DROP TABLE g1; +--echo # +--echo # MDEV-3819 missing constraints for spatial column types +--echo # + +create table t1 (pt point); +--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))')); +drop table t1; + --echo End of 5.5 tests |