From f2dfe5e8a57ff48fb39e257ed5c516d8bc8e1863 Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Thu, 24 Jun 2010 01:20:25 -0700 Subject: Fix Bug #54044 Create temporary tables and using innodb crashes. --- mysql-test/suite/innodb/r/innodb_bug54044.result | 3 +++ mysql-test/suite/innodb/t/innodb_bug54044.test | 11 ++++++++++ .../suite/innodb_plugin/r/innodb_bug54044.result | 3 +++ .../suite/innodb_plugin/t/innodb_bug54044.test | 11 ++++++++++ storage/innobase/handler/ha_innodb.cc | 24 ++++++++++++++++++++-- storage/innodb_plugin/ChangeLog | 5 +++++ storage/innodb_plugin/handler/ha_innodb.cc | 24 ++++++++++++++++++++-- 7 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 mysql-test/suite/innodb/r/innodb_bug54044.result create mode 100644 mysql-test/suite/innodb/t/innodb_bug54044.test create mode 100644 mysql-test/suite/innodb_plugin/r/innodb_bug54044.result create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_bug54044.test diff --git a/mysql-test/suite/innodb/r/innodb_bug54044.result b/mysql-test/suite/innodb/r/innodb_bug54044.result new file mode 100644 index 00000000000..9574381d8e1 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug54044.result @@ -0,0 +1,3 @@ +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) diff --git a/mysql-test/suite/innodb/t/innodb_bug54044.test b/mysql-test/suite/innodb/t/innodb_bug54044.test new file mode 100644 index 00000000000..824450ae1a6 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug54044.test @@ -0,0 +1,11 @@ +# 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); + diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result b/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result new file mode 100644 index 00000000000..9574381d8e1 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result @@ -0,0 +1,3 @@ +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) diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test b/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test new file mode 100644 index 00000000000..8958dba1c9b --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test @@ -0,0 +1,11 @@ +# 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_plugin.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); + diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index cf7ec4d6e6f..49fa3907bc4 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3236,6 +3236,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); } @@ -5257,7 +5262,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 { @@ -5314,7 +5334,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); diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 89823642957..9ea9d2cd153 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,8 @@ +2010-06-22 The InnoDB Team + + * handler/ha_innodb.cc, innodb_bug54044.test, innodb_bug54044.result + Fix Bug#54044, Create temporary tables and using innodb crashes. + 2010-05-25 The InnoDB Team * handler/ha_innodb.cc, include/row0mysql.h, row/row0mysql.c: diff --git a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc index c65ba3163fc..e5327863db4 100644 --- a/storage/innodb_plugin/handler/ha_innodb.cc +++ b/storage/innodb_plugin/handler/ha_innodb.cc @@ -3950,6 +3950,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: ut_error; } @@ -5997,7 +6002,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 { @@ -6055,7 +6075,7 @@ create_table_def( if (dict_col_name_is_reserved(field->field_name)){ my_error(ER_WRONG_COLUMN_NAME, MYF(0), field->field_name); - +err_col: dict_mem_table_free(table); trx_commit_for_mysql(trx); -- cgit v1.2.1 From 5bbdeada810ae838981c7bbecfeddda64076d7e4 Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Tue, 29 Jun 2010 00:13:18 -0700 Subject: Change the table name in innodb_bug54044 to lower case to avoid platform dependent diffs. --- mysql-test/suite/innodb/r/innodb_bug54044.result | 4 ++-- mysql-test/suite/innodb/t/innodb_bug54044.test | 2 +- mysql-test/suite/innodb_plugin/r/innodb_bug54044.result | 4 ++-- mysql-test/suite/innodb_plugin/t/innodb_bug54044.test | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb_bug54044.result b/mysql-test/suite/innodb/r/innodb_bug54044.result index 9574381d8e1..90ab812f2ae 100644 --- a/mysql-test/suite/innodb/r/innodb_bug54044.result +++ b/mysql-test/suite/innodb/r/innodb_bug54044.result @@ -1,3 +1,3 @@ -CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB +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) +ERROR HY000: Can't create table 'test.table_54044' (errno: -1) diff --git a/mysql-test/suite/innodb/t/innodb_bug54044.test b/mysql-test/suite/innodb/t/innodb_bug54044.test index 824450ae1a6..a6722ed6399 100644 --- a/mysql-test/suite/innodb/t/innodb_bug54044.test +++ b/mysql-test/suite/innodb/t/innodb_bug54044.test @@ -6,6 +6,6 @@ # This 'create table' operation should fail because of # using NULL datatype --error ER_CANT_CREATE_TABLE -CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB +CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB AS SELECT IF(NULL IS NOT NULL, NULL, NULL); diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result b/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result index 9574381d8e1..90ab812f2ae 100644 --- a/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result +++ b/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result @@ -1,3 +1,3 @@ -CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB +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) +ERROR HY000: Can't create table 'test.table_54044' (errno: -1) diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test b/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test index 8958dba1c9b..58f60a54130 100644 --- a/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test +++ b/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test @@ -6,6 +6,6 @@ # This 'create table' operation should fail because of # using NULL datatype --error ER_CANT_CREATE_TABLE -CREATE TEMPORARY TABLE TABLE_54044 ENGINE = INNODB +CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB AS SELECT IF(NULL IS NOT NULL, NULL, NULL); -- cgit v1.2.1 From 1bfb6949bc867f20fe86c55b649188ab2297a357 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 2 Jul 2010 14:31:16 +0300 Subject: merge --- .bzr-mysql/default.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index e613cefc614..77df77c6021 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] -post_commit_to = "commits@lists.mysql.com" -post_push_to = "commits@lists.mysql.com" -tree_name = "mysql-5.1-bugteam" +post_commit_to = "dbg_mysql_security@sun.com" +post_push_to = "dbg_mysql_security@sun.com" +tree_name = "mysql-5.1-security" -- cgit v1.2.1 From 0f5fed201fee686ddafb3221e3a055aa8fc194e6 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 2 Jul 2010 14:33:17 +0300 Subject: merge --- .bzr-mysql/default.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index 557df1b1ffe..4b2affc1529 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] -post_commit_to = "commits@lists.mysql.com" -post_push_to = "commits@lists.mysql.com" -tree_name = "mysql-5.0-bugteam" +post_commit_to = "dbg_mysql_security@sun.com" +post_push_to = "dbg_mysql_security@sun.com" +tree_name = "mysql-5.0-security" -- cgit v1.2.1