1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +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.


mysql-test/r/alter_table.result:
  Bug #26794: 5.1 part
   test case
mysql-test/r/gis-rtree.result:
  Bug #26794: 5.1 part
   updated the tests to the new syntax
mysql-test/t/alter_table.test:
  Bug #26794: 5.1 part
   test case
mysql-test/t/gis-rtree.test:
  Bug #26794: 5.1 part
   updated the tests to the new syntax
sql/sql_table.cc:
  Bug #26794: 5.1 part
   Disable defining SPATIAL KEYS with sub-key parts
This commit is contained in:
unknown
2007-03-14 12:20:34 +02:00
parent d92106135d
commit 6e10a2048d
5 changed files with 24 additions and 10 deletions

View File

@ -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');