mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug #26794: 5.1 part
It was syntactically correct to define spatial keys over parts of columns (e.g. ALTER TABLE t1 ADD x GEOMETRY NOT NULL, ADD SPATIAL KEY (x(32))). This may lead to undefined results and/or interpretation. Fixed by not allowing partial column specification in a SPATIAL index definition.
This commit is contained in:
@ -886,7 +886,7 @@ ALTER TABLE t1 ADD b GEOMETRY NOT NULL, ADD SPATIAL INDEX(b);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` varchar(500) default NULL,
|
||||
`a` varchar(500) DEFAULT NULL,
|
||||
`b` geometry NOT NULL,
|
||||
SPATIAL KEY `b` (`b`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
@ -894,7 +894,7 @@ ALTER TABLE t1 ADD KEY(b(50));
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` varchar(500) default NULL,
|
||||
`a` varchar(500) DEFAULT NULL,
|
||||
`b` geometry NOT NULL,
|
||||
SPATIAL KEY `b` (`b`),
|
||||
KEY `b_2` (`b`(50))
|
||||
@ -903,9 +903,9 @@ ALTER TABLE t1 ADD c POINT;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` varchar(500) default NULL,
|
||||
`a` varchar(500) DEFAULT NULL,
|
||||
`b` geometry NOT NULL,
|
||||
`c` point default NULL,
|
||||
`c` point DEFAULT NULL,
|
||||
SPATIAL KEY `b` (`b`),
|
||||
KEY `b_2` (`b`(50))
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
@ -914,6 +914,8 @@ ERROR HY000: Incorrect sub part key; the used key part isn't a string, the used
|
||||
ALTER TABLE t1 ADD d INT;
|
||||
ALTER TABLE t1 ADD KEY (d(20));
|
||||
ERROR HY000: Incorrect sub part key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique sub keys
|
||||
ALTER TABLE t1 ADD e GEOMETRY NOT NULL, ADD SPATIAL KEY (e(30));
|
||||
ERROR HY000: Incorrect sub part key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique sub keys
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (s CHAR(8) BINARY);
|
||||
INSERT INTO t1 VALUES ('test');
|
||||
|
@ -803,7 +803,7 @@ CREATE TABLE t2 (geom GEOMETRY NOT NULL, SPATIAL KEY gk(geom));
|
||||
INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||
drop table t1, t2;
|
||||
CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`(32))) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
Warnings:
|
||||
Warning 1101 BLOB/TEXT column 'geometry' can't have a default value
|
||||
INSERT INTO t1 (geometry) VALUES
|
||||
@ -820,7 +820,7 @@ test.t1 check status OK
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 geometry NOT NULL default '',
|
||||
SPATIAL KEY i1 (c1(32))
|
||||
SPATIAL KEY i1 (c1)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
Warnings:
|
||||
Warning 1101 BLOB/TEXT column 'c1' can't have a default value
|
||||
@ -836,7 +836,7 @@ test.t1 check status OK
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 geometry NOT NULL default '',
|
||||
SPATIAL KEY i1 (c1(32))
|
||||
SPATIAL KEY i1 (c1)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
Warnings:
|
||||
Warning 1101 BLOB/TEXT column 'c1' can't have a default value
|
||||
|
@ -662,6 +662,10 @@ ALTER TABLE t1 ADD d INT;
|
||||
--error ER_WRONG_SUB_KEY
|
||||
ALTER TABLE t1 ADD KEY (d(20));
|
||||
|
||||
# the 5.1 part of the test
|
||||
--error ER_WRONG_SUB_KEY
|
||||
ALTER TABLE t1 ADD e GEOMETRY NOT NULL, ADD SPATIAL KEY (e(30));
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
|
@ -172,7 +172,7 @@ CREATE TABLE t2 (geom GEOMETRY NOT NULL, SPATIAL KEY gk(geom));
|
||||
INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
|
||||
drop table t1, t2;
|
||||
|
||||
CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`(32))) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
INSERT INTO t1 (geometry) VALUES
|
||||
(PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, -18.6055555000
|
||||
@ -192,7 +192,7 @@ drop table t1;
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
c1 geometry NOT NULL default '',
|
||||
SPATIAL KEY i1 (c1(32))
|
||||
SPATIAL KEY i1 (c1)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
INSERT INTO t1 (c1) VALUES (
|
||||
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
|
||||
@ -206,7 +206,7 @@ DROP TABLE t1;
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
c1 geometry NOT NULL default '',
|
||||
SPATIAL KEY i1 (c1(32))
|
||||
SPATIAL KEY i1 (c1)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
INSERT INTO t1 (c1) VALUES (
|
||||
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
|
||||
|
Reference in New Issue
Block a user