mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Applying InnoDB plugin snashot
Detailed revision comments: r6099 | jyang | 2009-10-22 05:58:39 +0300 (Thu, 22 Oct 2009) | 7 lines branches/zip: Port bug #46000 related changes from 5.1 to zip branch. Due to different code path for creating index in zip branch comparing to 5.1), the index reserved name check function is extended to be used in ha_innobase::add_index(). rb://190 Approved by: Marko
This commit is contained in:
@@ -229,21 +229,6 @@ static handler *innobase_create_handler(handlerton *hton,
|
||||
TABLE_SHARE *table,
|
||||
MEM_ROOT *mem_root);
|
||||
|
||||
/***********************************************************************
|
||||
This function checks each index name for a table against reserved
|
||||
system default primary index name 'GEN_CLUST_INDEX'. If a name matches,
|
||||
this function pushes an error message to the client, and returns true. */
|
||||
static
|
||||
bool
|
||||
innobase_index_name_is_reserved(
|
||||
/*============================*/
|
||||
/* out: true if index name matches a
|
||||
reserved name */
|
||||
const trx_t* trx, /* in: InnoDB transaction handle */
|
||||
const TABLE* form, /* in: information on table
|
||||
columns and indexes */
|
||||
const char* norm_name); /* in: table name */
|
||||
|
||||
/* "GEN_CLUST_INDEX" is the name reserved for Innodb default
|
||||
system primary index. */
|
||||
static const char innobase_index_reserve_name[]= "GEN_CLUST_INDEX";
|
||||
@@ -6342,7 +6327,8 @@ ha_innobase::create(
|
||||
|
||||
/* Check for name conflicts (with reserved name) for
|
||||
any user indices to be created. */
|
||||
if (innobase_index_name_is_reserved(trx, form, norm_name)) {
|
||||
if (innobase_index_name_is_reserved(trx, form->key_info,
|
||||
form->s->keys)) {
|
||||
error = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -9804,36 +9790,39 @@ static int show_innodb_vars(THD *thd, SHOW_VAR *var, char *buff)
|
||||
/***********************************************************************
|
||||
This function checks each index name for a table against reserved
|
||||
system default primary index name 'GEN_CLUST_INDEX'. If a name matches,
|
||||
this function pushes an error message to the client, and returns true. */
|
||||
static
|
||||
this function pushes an warning message to the client, and returns true. */
|
||||
extern "C" UNIV_INTERN
|
||||
bool
|
||||
innobase_index_name_is_reserved(
|
||||
/*============================*/
|
||||
/* out: true if an index name
|
||||
matches the reserved name */
|
||||
const trx_t* trx, /* in: InnoDB transaction handle */
|
||||
const TABLE* form, /* in: information on table
|
||||
columns and indexes */
|
||||
const char* norm_name) /* in: table name */
|
||||
const KEY* key_info, /* in: Indexes to be created */
|
||||
ulint num_of_keys) /* in: Number of indexes to
|
||||
be created. */
|
||||
{
|
||||
KEY* key;
|
||||
const KEY* key;
|
||||
uint key_num; /* index number */
|
||||
|
||||
for (key_num = 0; key_num < form->s->keys; key_num++) {
|
||||
key = form->key_info + key_num;
|
||||
for (key_num = 0; key_num < num_of_keys; key_num++) {
|
||||
key = &key_info[key_num];
|
||||
|
||||
if (innobase_strcasecmp(key->name,
|
||||
innobase_index_reserve_name) == 0) {
|
||||
/* Push warning to mysql */
|
||||
push_warning_printf((THD*) trx->mysql_thd,
|
||||
MYSQL_ERROR::WARN_LEVEL_ERROR,
|
||||
ER_CANT_CREATE_TABLE,
|
||||
MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_WRONG_NAME_FOR_INDEX,
|
||||
"Cannot Create Index with name "
|
||||
"'%s'. The name is reserved "
|
||||
"for the system default primary "
|
||||
"index.",
|
||||
innobase_index_reserve_name);
|
||||
|
||||
my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0),
|
||||
innobase_index_reserve_name);
|
||||
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user