diff options
author | Satya B <satya.bn@sun.com> | 2009-10-05 16:47:48 +0530 |
---|---|---|
committer | Satya B <satya.bn@sun.com> | 2009-10-05 16:47:48 +0530 |
commit | 95c6cc51a549955120d26871411e2982d923fc39 (patch) | |
tree | 8e4118c80b8df0f3034ddf037334bfd82958a176 /storage/innobase/handler | |
parent | b9ce9f79d66585d27bab9d1d9da1c2833e1416b2 (diff) | |
download | mariadb-git-95c6cc51a549955120d26871411e2982d923fc39.tar.gz |
Applying InnoDB snapshot 5.1-ss5921, part 2. Fixes BUG#44369
BUG#44369 - InnoDB: Does not uniformly disallow disallowed column names
Detailed revision comments:
r5741 | jyang | 2009-09-03 07:16:01 +0300 (Thu, 03 Sep 2009) | 5 lines
branches/5.1: Block creating table with column name conflicting
with Innodb reserved key words. (Bug #44369) rb://151 approved
by Sunny Bains.
r5760 | jyang | 2009-09-04 07:07:34 +0300 (Fri, 04 Sep 2009) | 3 lines
branches/5.1: This is to revert change 5741. A return status for
create_table_def() needs to be fixed.
r5834 | jyang | 2009-09-11 00:43:05 +0300 (Fri, 11 Sep 2009) | 5 lines
branches/5.1: Block creating table with column name conflicting
with Innodb reserved key words. (Bug #44369) rb://151 approved
by Sunny Bains.
Diffstat (limited to 'storage/innobase/handler')
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 10f8da40b36..3431a5c7e37 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -5166,6 +5166,28 @@ create_table_def( } } + /* First check whether the column to be added has a + system reserved name. */ + if (dict_col_name_is_reserved(field->field_name)){ + push_warning_printf( + (THD*) trx->mysql_thd, + MYSQL_ERROR::WARN_LEVEL_ERROR, + ER_CANT_CREATE_TABLE, + "Error creating table '%s' with " + "column name '%s'. '%s' is a " + "reserved name. Please try to " + "re-create the table with a " + "different column name.", + table->name, (char*) field->field_name, + (char*) field->field_name); + + dict_mem_table_free(table); + trx_commit_for_mysql(trx); + + error = DB_ERROR; + goto error_ret; + } + dict_mem_table_add_col(table, table->heap, (char*) field->field_name, col_type, @@ -5181,6 +5203,7 @@ create_table_def( innodb_check_for_record_too_big_error(flags & DICT_TF_COMPACT, error); +error_ret: error = convert_error_code_to_mysql(error, NULL); DBUG_RETURN(error); |