MDEV-5787 Server crashes in in row_mysql_convert_row_to_innobase on CREATE .. SELECT

XtraDB: don't accept MYSQL_TYPE_NULL as a column type
This commit is contained in:
Sergei Golubchik 2014-03-19 09:57:57 +01:00
parent 3e3d627114
commit 948056c535
3 changed files with 20 additions and 4 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;
}