Commit 1ac84a45 authored by Jimmy Yang's avatar Jimmy Yang

Fix bug #54044, Create temporary tables and using innodb crashes. Screen

out NULL type columns, and return without creating the table.

rb://378 approved by Marko
parent d17ee9f8
CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB
AS SELECT IF(NULL IS NOT NULL, NULL, NULL);
ERROR HY000: Can't create table 'test.TABLE_54044' (errno: -1)
# This is the test for bug #54044. Special handle MYSQL_TYPE_NULL type
# during create table, so it will not trigger assertion failure.
--source include/have_innodb.inc
# This 'create table' operation should fail because of
# using NULL datatype
--error ER_CANT_CREATE_TABLE
CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB
AS SELECT IF(NULL IS NOT NULL, NULL, NULL);
......@@ -3242,6 +3242,11 @@ get_innobase_type_from_mysql_type(
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_LONG_BLOB:
return(DATA_BLOB);
case MYSQL_TYPE_NULL:
/* MySQL currently accepts "NULL" datatype, but will
reject such datatype in the next release. We will cope
with it and not trigger assertion failure in 5.1 */
break;
default:
assert(0);
}
......@@ -5263,7 +5268,22 @@ create_table_def(
field = form->field[i];
col_type = get_innobase_type_from_mysql_type(&unsigned_type,
field);
field);
if (!col_type) {
push_warning_printf(
(THD*) trx->mysql_thd,
MYSQL_ERROR::WARN_LEVEL_WARN,
ER_CANT_CREATE_TABLE,
"Error creating table '%s' with "
"column '%s'. Please check its "
"column type and try to re-create "
"the table with an appropriate "
"column type.",
table->name, (char*) field->field_name);
goto err_col;
}
if (field->null_ptr) {
nulls_allowed = 0;
} else {
......@@ -5320,7 +5340,7 @@ create_table_def(
"different column name.",
table->name, (char*) field->field_name,
(char*) field->field_name);
err_col:
dict_mem_table_free(table);
trx_commit_for_mysql(trx);
......
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