-
Neeraj Bisht authored
Problem:- In myisam engine. If we run a query which is creating a table with select statement on a function statement, which return null as one of its column result in select query.Mysql deamon crashes. If we are not able to generate the problem we have to run this query few times. Analysis:- If we have a null-constant in our select query, we are treating it as a binary type field, in both innodb and myisam engine. mysql> create table `t1` select null as a; mysql> show create table t1; +-------+----------------------- | Table | Create Table +-------+----------------------- | t1 | CREATE TABLE `t1` ( `a` binary(0) DEFAULT NULL ) ENGINE=MYISAM DEFAULT CHARSET=latin1 | +-------+--------------------------------- If we have a null returning function in our select query, we are treating it as null type field in myisam and giving error in innodb. For example:- mysql> Create table t1 engine=myisam select coalesce(null); mysql> show create table t1; +-------+---------------------------------- | Table | Create Table +-------+---------------------------------- | t1 | CREATE TABLE `t1` ( `a` null DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 | +-------+---------------------------------- which is creating a problem. Solution:- Instead of creating a field type of null, now we are creating a binary of length zero.
Neeraj Bisht authoredProblem:- In myisam engine. If we run a query which is creating a table with select statement on a function statement, which return null as one of its column result in select query.Mysql deamon crashes. If we are not able to generate the problem we have to run this query few times. Analysis:- If we have a null-constant in our select query, we are treating it as a binary type field, in both innodb and myisam engine. mysql> create table `t1` select null as a; mysql> show create table t1; +-------+----------------------- | Table | Create Table +-------+----------------------- | t1 | CREATE TABLE `t1` ( `a` binary(0) DEFAULT NULL ) ENGINE=MYISAM DEFAULT CHARSET=latin1 | +-------+--------------------------------- If we have a null returning function in our select query, we are treating it as null type field in myisam and giving error in innodb. For example:- mysql> Create table t1 engine=myisam select coalesce(null); mysql> show create table t1; +-------+---------------------------------- | Table | Create Table +-------+---------------------------------- | t1 | CREATE TABLE `t1` ( `a` null DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 | +-------+---------------------------------- which is creating a problem. Solution:- Instead of creating a field type of null, now we are creating a binary of length zero.
Loading