diff --git a/mysql-test/suite/innodb/r/innodb_bug54044.result b/mysql-test/suite/innodb/r/innodb_bug54044.result index 4935febcbfb..d80c451c841 100644 --- a/mysql-test/suite/innodb/r/innodb_bug54044.result +++ b/mysql-test/suite/innodb/r/innodb_bug54044.result @@ -15,3 +15,9 @@ tmp CREATE TABLE `tmp` ( `NULL` binary(0) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE tmp; +CREATE TABLE t1 (a VARCHAR(3)) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('foo'),('bar'); +FLUSH TABLES; +CREATE TEMPORARY TABLE tmp ENGINE=InnoDB AS SELECT VALUES(a) FROM t1; +ERROR HY000: Can't create table `test`.`tmp` (errno: -1 "Internal error < 0 (Not system error)") +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb_bug54044.test b/mysql-test/suite/innodb/t/innodb_bug54044.test index 13c37d9c841..aa19c51018c 100644 --- a/mysql-test/suite/innodb/t/innodb_bug54044.test +++ b/mysql-test/suite/innodb/t/innodb_bug54044.test @@ -10,10 +10,17 @@ CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB SHOW CREATE TABLE table_54044; DROP TABLE table_54044; -# These 'create table' operations should fail because of -# using NULL datatype - CREATE TABLE tmp ENGINE = INNODB AS SELECT COALESCE(NULL, NULL, NULL), GREATEST(NULL, NULL), NULL; SHOW CREATE TABLE tmp; DROP TABLE tmp; +# These 'create table' operations should fail because of +# using NULL datatype + +CREATE TABLE t1 (a VARCHAR(3)) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('foo'),('bar'); +FLUSH TABLES; +--error 1005 +CREATE TEMPORARY TABLE tmp ENGINE=InnoDB AS SELECT VALUES(a) FROM t1; +DROP TABLE t1; + diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index a40463d3bd8..1b3a4805e78 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -6367,7 +6367,10 @@ get_innobase_type_from_mysql_type( case MYSQL_TYPE_LONG_BLOB: return(DATA_BLOB); case MYSQL_TYPE_NULL: - return(DATA_FIXBINARY); + /* 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; }