List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:July 2 2010 11:30am
Subject:bzr commit into mysql-5.1-bugteam branch (Georgi.Kodinov:3458)
View as plain text  
#At file:///home/kgeorge/mysql/work/merge-5.1-bugteam/ based on revid:georgi.kodinov@stripped

 3458 Georgi Kodinov	2010-07-02 [merge]
      merge

    added:
      mysql-test/suite/innodb/r/innodb_bug54044.result
      mysql-test/suite/innodb/t/innodb_bug54044.test
      mysql-test/suite/innodb_plugin/r/innodb_bug54044.result
      mysql-test/suite/innodb_plugin/t/innodb_bug54044.test
    modified:
      storage/innobase/handler/ha_innodb.cc
      storage/innodb_plugin/ChangeLog
      storage/innodb_plugin/handler/ha_innodb.cc
=== added file 'mysql-test/suite/innodb/r/innodb_bug54044.result'
--- a/mysql-test/suite/innodb/r/innodb_bug54044.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/r/innodb_bug54044.result	2010-06-29 07:13:18 +0000
@@ -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)

=== added file 'mysql-test/suite/innodb/t/innodb_bug54044.test'
--- a/mysql-test/suite/innodb/t/innodb_bug54044.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/t/innodb_bug54044.test	2010-06-29 07:13:18 +0000
@@ -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); 
+

=== added file 'mysql-test/suite/innodb_plugin/r/innodb_bug54044.result'
--- a/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result	2010-06-29 07:13:18 +0000
@@ -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)

=== added file 'mysql-test/suite/innodb_plugin/t/innodb_bug54044.test'
--- a/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test	2010-06-29 07:13:18 +0000
@@ -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); 
+

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2010-05-20 07:39:02 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2010-06-24 08:20:25 +0000
@@ -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);
 

=== modified file 'storage/innodb_plugin/ChangeLog'
--- a/storage/innodb_plugin/ChangeLog	2010-05-26 05:38:14 +0000
+++ b/storage/innodb_plugin/ChangeLog	2010-06-24 08:20:25 +0000
@@ -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:

=== modified file 'storage/innodb_plugin/handler/ha_innodb.cc'
--- a/storage/innodb_plugin/handler/ha_innodb.cc	2010-05-28 13:17:37 +0000
+++ b/storage/innodb_plugin/handler/ha_innodb.cc	2010-06-24 08:20:25 +0000
@@ -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);
 


Attachment: [text/bzr-bundle] bzr/georgi.kodinov@oracle.com-20100702112955-f576o6s6bxmdd31g.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (Georgi.Kodinov:3458) Georgi Kodinov2 Jul