Commit e39ff6b0 authored by jyang's avatar jyang

branches/5.1: Revert change in 5740. Making the fix in a subsequent

check in.
parent e4d73324
......@@ -165,7 +165,6 @@ static handler *innobase_create_handler(handlerton *hton,
MEM_ROOT *mem_root);
static const char innobase_hton_name[]= "InnoDB";
static const char innobase_idx_reserve_name[]= "GEN_CLUST_INDEX";
/** @brief Initialize the default value of innodb_commit_concurrency.
......@@ -5136,22 +5135,6 @@ create_index(
n_fields = key->key_parts;
/* Do not allow creating index with the name of "GEN_CLUST_INDEX",
which is the name reserved for default primary index created by
innodb. Innodb does not support indices with duplicated name. */
if (innobase_strcasecmp(key->name, innobase_idx_reserve_name) == 0) {
push_warning_printf(
(THD *)trx->mysql_thd,
MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_CANT_CREATE_TABLE,
"Cannot Create Index with name "
"'%s'. The name is reserved "
"for the system default primary index.",
innobase_idx_reserve_name);
DBUG_RETURN(DB_RESERVED_NAME);
}
ind_type = 0;
if (key_num == form->s->primary_key) {
......@@ -5265,7 +5248,7 @@ create_clustered_index_when_no_primary(
/* We pass 0 as the space id, and determine at a lower level the space
id where to store the table */
index = dict_mem_index_create(table_name, innobase_idx_reserve_name,
index = dict_mem_index_create(table_name, "GEN_CLUST_INDEX",
0, DICT_CLUSTERED, 0);
error = row_create_index_for_mysql(index, trx, NULL);
......@@ -5510,12 +5493,6 @@ ha_innobase::create(
DBUG_RETURN(0);
cleanup:
/* Fail to create index with name conflicting with system
reserved names. Drop the (temp) table before return. */
if (error == DB_RESERVED_NAME) {
row_drop_table_for_mysql(norm_name, trx, 0);
}
innobase_commit_low(trx);
row_mysql_unlock_data_dictionary(trx);
......
......@@ -69,9 +69,6 @@ Created 5/24/1996 Heikki Tuuri
a feature that it can't recoginize or
work with e.g., FT indexes created by
a later version of the engine. */
#define DB_RESERVED_NAME 49 /* Name used is conflicting with an
internal System Reserved Name. */
/* The following are partial failure codes */
#define DB_FAIL 1000
#define DB_OVERFLOW 1001
......
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;
# 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;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment