1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

branches/5.1: Disallow creating index with the name of

"GEN_CLUST_INDEX" which is reserved for the default system
primary index. (Bug #46000) rb://149 approved by Sunny Bains.
This commit is contained in:
jyang
2009-09-03 02:33:47 +00:00
parent 257804f692
commit 09ced1197d
4 changed files with 81 additions and 1 deletions

View File

@ -0,0 +1,18 @@
SET storage_engine=InnoDB;
create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
ERROR HY000: Can't create table 'test.bug46000' (errno: 49)
create table bug46000(`id` int,key `GEN_clust_INDEX`(`id`))engine=innodb;
ERROR HY000: Can't create table 'test.bug46000' (errno: 49)
show errors;
Level Code Message
Error 1005 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for system default primary index.
Error 1005 Can't create table 'test.bug46000' (errno: 49)
create table bug46000(id int) engine = innodb;
create index GEN_CLUST_INDEX on bug46000(id);
ERROR HY000: Can't create table '#sql-temporary' (errno: 49)
show errors;
Level Code Message
Error 1005 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for system default primary index.
Error 1005 Can't create table 'test.#sql-2cb4_2' (errno: 49)
create index idx on bug46000(id);
drop table bug46000;

View File

@ -0,0 +1,36 @@
# This is the test for bug 46000. We shall
# block any index creation with the name of
# "GEN_CLUST_INDEX", which is the reserved
# name for innodb default primary index.
--source include/have_innodb.inc
SET storage_engine=InnoDB;
# This 'create table' operation should fail because of
# using the reserve name as its index name.
--error ER_CANT_CREATE_TABLE
create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
# Mixed upper/lower case of the reserved key words
--error ER_CANT_CREATE_TABLE
create table bug46000(`id` int,key `GEN_clust_INDEX`(`id`))engine=innodb;
show errors;
create table bug46000(id int) engine = innodb;
# This 'create index' operation should fail.
--replace_regex /'[^']*test.#sql-[0-9a-f_]*'/'#sql-temporary'/
--error ER_CANT_CREATE_TABLE
create index GEN_CLUST_INDEX on bug46000(id);
show errors;
# This 'create index' operation should succeed, no
# temp table left from last failed create index
# operation.
create index idx on bug46000(id);
drop table bug46000;