Loading myisam/mi_key.c +2 −2 Original line number Diff line number Diff line Loading @@ -241,8 +241,8 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, if (!(*key++= (char) 1-*old++)) /* Copy null marker */ { k_length-=length; if (keyseg->flag & (HA_VAR_LENGTH_PART | HA_BLOB_PART)) { ->flag & (HA_VAR_LENGTH_PART | HA_BLOB_PART)) k_length-=2; /* Skip length */ old+= 2; } Loading mysql-test/r/create.result +67 −1 Original line number Diff line number Diff line drop table if exists t1,t2,t3; drop table if exists t1,t2,t3,t4,t5; drop database if exists mysqltest; create table t1 (b char(0)); insert into t1 values (""),(null); Loading Loading @@ -654,3 +654,69 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; CREATE TABLE t2 ( a int(11) default NULL ); insert into t2 values(111); create table t1 ( a varchar(12) charset utf8 collate utf8_bin not null, b int not null, primary key (a) ) select a, 1 as b from t2 ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(12) character set utf8 collate utf8_bin NOT NULL default '', `b` int(11) NOT NULL default '0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 ( a varchar(12) charset utf8 collate utf8_bin not null, b int not null, primary key (a) ) select 'a' as a , 1 as b from t2 ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(12) character set utf8 collate utf8_bin NOT NULL default '', `b` int(11) NOT NULL default '0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 ( a varchar(12) charset utf8 collate utf8_bin, b int not null, primary key (a) ) select 'a' as a , 1 as b from t2 ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(12) character set utf8 collate utf8_bin NOT NULL default '', `b` int(11) NOT NULL default '0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1, t2; create table t1 ( a1 int not null, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int ); insert into t1 values (1,1,1, 1,1,1, 1,1,1); create table t2 ( a1 varchar(12) charset utf8 collate utf8_bin not null, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, primary key (a1) ) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ; drop table t2; create table t2 ( a1 varchar(12) charset utf8 collate utf8_bin, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int ) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1; drop table t1, t2; create table t1 ( a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int ); insert into t1 values (1,1,1, 1,1,1, 1,1,1); create table t2 ( a1 varchar(12) charset utf8 collate utf8_bin not null, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, primary key (a1) ) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ; drop table t1, t2; mysql-test/r/myisam.result +18 −0 Original line number Diff line number Diff line Loading @@ -701,6 +701,24 @@ t1 1 a 2 b A 0 NULL NULL YES BTREE t1 1 a 3 c A 0 NULL NULL YES BTREE t1 1 a 4 d A 0 NULL NULL YES BTREE set myisam_stats_method=DEFAULT; drop table t1; create table t1( cip INT NOT NULL, time TIME NOT NULL, score INT NOT NULL DEFAULT 0, bob TINYBLOB ); insert into t1 (cip, time) VALUES (1, '00:01'), (2, '00:02'), (3,'00:03'); insert into t1 (cip, bob, time) VALUES (4, 'a', '00:04'), (5, 'b', '00:05'), (6, 'c', '00:06'); select * from t1 where bob is null and cip=1; cip time score bob 1 00:01:00 0 NULL create index bug on t1 (bob(22), cip, time); select * from t1 where bob is null and cip=1; cip time score bob 1 00:01:00 0 NULL drop table t1; set storage_engine=MyISAM; drop table if exists t1,t2,t3; --- Testing varchar --- Loading mysql-test/t/create.test +63 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ # --disable_warnings drop table if exists t1,t2,t3; drop table if exists t1,t2,t3,t4,t5; drop database if exists mysqltest; --enable_warnings Loading Loading @@ -554,4 +554,66 @@ create table t1 ( show create table t1; drop table t1; # # BUG#14480: assert failure in CREATE ... SELECT because of wrong # calculation of number of NULLs. # CREATE TABLE t2 ( a int(11) default NULL ); insert into t2 values(111); create table t1 ( a varchar(12) charset utf8 collate utf8_bin not null, b int not null, primary key (a) ) select a, 1 as b from t2 ; show create table t1; drop table t1; create table t1 ( a varchar(12) charset utf8 collate utf8_bin not null, b int not null, primary key (a) ) select 'a' as a , 1 as b from t2 ; show create table t1; drop table t1; create table t1 ( a varchar(12) charset utf8 collate utf8_bin, b int not null, primary key (a) ) select 'a' as a , 1 as b from t2 ; show create table t1; drop table t1, t2; create table t1 ( a1 int not null, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int ); insert into t1 values (1,1,1, 1,1,1, 1,1,1); create table t2 ( a1 varchar(12) charset utf8 collate utf8_bin not null, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, primary key (a1) ) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ; drop table t2; create table t2 ( a1 varchar(12) charset utf8 collate utf8_bin, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int ) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1; drop table t1, t2; create table t1 ( a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int ); insert into t1 values (1,1,1, 1,1,1, 1,1,1); create table t2 ( a1 varchar(12) charset utf8 collate utf8_bin not null, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, primary key (a1) ) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ; drop table t1, t2; # End of 4.1 tests mysql-test/t/myisam.test +18 −0 Original line number Diff line number Diff line Loading @@ -648,6 +648,24 @@ analyze table t1; show index from t1; set myisam_stats_method=DEFAULT; drop table t1; # BUG#13814 - key value packed incorrectly for TINYBLOBs create table t1( cip INT NOT NULL, time TIME NOT NULL, score INT NOT NULL DEFAULT 0, bob TINYBLOB ); insert into t1 (cip, time) VALUES (1, '00:01'), (2, '00:02'), (3,'00:03'); insert into t1 (cip, bob, time) VALUES (4, 'a', '00:04'), (5, 'b', '00:05'), (6, 'c', '00:06'); select * from t1 where bob is null and cip=1; create index bug on t1 (bob(22), cip, time); select * from t1 where bob is null and cip=1; drop table t1; # End of 4.1 tests # Loading Loading
myisam/mi_key.c +2 −2 Original line number Diff line number Diff line Loading @@ -241,8 +241,8 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, if (!(*key++= (char) 1-*old++)) /* Copy null marker */ { k_length-=length; if (keyseg->flag & (HA_VAR_LENGTH_PART | HA_BLOB_PART)) { ->flag & (HA_VAR_LENGTH_PART | HA_BLOB_PART)) k_length-=2; /* Skip length */ old+= 2; } Loading
mysql-test/r/create.result +67 −1 Original line number Diff line number Diff line drop table if exists t1,t2,t3; drop table if exists t1,t2,t3,t4,t5; drop database if exists mysqltest; create table t1 (b char(0)); insert into t1 values (""),(null); Loading Loading @@ -654,3 +654,69 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; CREATE TABLE t2 ( a int(11) default NULL ); insert into t2 values(111); create table t1 ( a varchar(12) charset utf8 collate utf8_bin not null, b int not null, primary key (a) ) select a, 1 as b from t2 ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(12) character set utf8 collate utf8_bin NOT NULL default '', `b` int(11) NOT NULL default '0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 ( a varchar(12) charset utf8 collate utf8_bin not null, b int not null, primary key (a) ) select 'a' as a , 1 as b from t2 ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(12) character set utf8 collate utf8_bin NOT NULL default '', `b` int(11) NOT NULL default '0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 ( a varchar(12) charset utf8 collate utf8_bin, b int not null, primary key (a) ) select 'a' as a , 1 as b from t2 ; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(12) character set utf8 collate utf8_bin NOT NULL default '', `b` int(11) NOT NULL default '0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1, t2; create table t1 ( a1 int not null, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int ); insert into t1 values (1,1,1, 1,1,1, 1,1,1); create table t2 ( a1 varchar(12) charset utf8 collate utf8_bin not null, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, primary key (a1) ) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ; drop table t2; create table t2 ( a1 varchar(12) charset utf8 collate utf8_bin, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int ) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1; drop table t1, t2; create table t1 ( a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int ); insert into t1 values (1,1,1, 1,1,1, 1,1,1); create table t2 ( a1 varchar(12) charset utf8 collate utf8_bin not null, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, primary key (a1) ) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ; drop table t1, t2;
mysql-test/r/myisam.result +18 −0 Original line number Diff line number Diff line Loading @@ -701,6 +701,24 @@ t1 1 a 2 b A 0 NULL NULL YES BTREE t1 1 a 3 c A 0 NULL NULL YES BTREE t1 1 a 4 d A 0 NULL NULL YES BTREE set myisam_stats_method=DEFAULT; drop table t1; create table t1( cip INT NOT NULL, time TIME NOT NULL, score INT NOT NULL DEFAULT 0, bob TINYBLOB ); insert into t1 (cip, time) VALUES (1, '00:01'), (2, '00:02'), (3,'00:03'); insert into t1 (cip, bob, time) VALUES (4, 'a', '00:04'), (5, 'b', '00:05'), (6, 'c', '00:06'); select * from t1 where bob is null and cip=1; cip time score bob 1 00:01:00 0 NULL create index bug on t1 (bob(22), cip, time); select * from t1 where bob is null and cip=1; cip time score bob 1 00:01:00 0 NULL drop table t1; set storage_engine=MyISAM; drop table if exists t1,t2,t3; --- Testing varchar --- Loading
mysql-test/t/create.test +63 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ # --disable_warnings drop table if exists t1,t2,t3; drop table if exists t1,t2,t3,t4,t5; drop database if exists mysqltest; --enable_warnings Loading Loading @@ -554,4 +554,66 @@ create table t1 ( show create table t1; drop table t1; # # BUG#14480: assert failure in CREATE ... SELECT because of wrong # calculation of number of NULLs. # CREATE TABLE t2 ( a int(11) default NULL ); insert into t2 values(111); create table t1 ( a varchar(12) charset utf8 collate utf8_bin not null, b int not null, primary key (a) ) select a, 1 as b from t2 ; show create table t1; drop table t1; create table t1 ( a varchar(12) charset utf8 collate utf8_bin not null, b int not null, primary key (a) ) select 'a' as a , 1 as b from t2 ; show create table t1; drop table t1; create table t1 ( a varchar(12) charset utf8 collate utf8_bin, b int not null, primary key (a) ) select 'a' as a , 1 as b from t2 ; show create table t1; drop table t1, t2; create table t1 ( a1 int not null, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int ); insert into t1 values (1,1,1, 1,1,1, 1,1,1); create table t2 ( a1 varchar(12) charset utf8 collate utf8_bin not null, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, primary key (a1) ) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ; drop table t2; create table t2 ( a1 varchar(12) charset utf8 collate utf8_bin, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int ) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1; drop table t1, t2; create table t1 ( a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int ); insert into t1 values (1,1,1, 1,1,1, 1,1,1); create table t2 ( a1 varchar(12) charset utf8 collate utf8_bin not null, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, primary key (a1) ) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ; drop table t1, t2; # End of 4.1 tests
mysql-test/t/myisam.test +18 −0 Original line number Diff line number Diff line Loading @@ -648,6 +648,24 @@ analyze table t1; show index from t1; set myisam_stats_method=DEFAULT; drop table t1; # BUG#13814 - key value packed incorrectly for TINYBLOBs create table t1( cip INT NOT NULL, time TIME NOT NULL, score INT NOT NULL DEFAULT 0, bob TINYBLOB ); insert into t1 (cip, time) VALUES (1, '00:01'), (2, '00:02'), (3,'00:03'); insert into t1 (cip, bob, time) VALUES (4, 'a', '00:04'), (5, 'b', '00:05'), (6, 'c', '00:06'); select * from t1 where bob is null and cip=1; create index bug on t1 (bob(22), cip, time); select * from t1 where bob is null and cip=1; drop table t1; # End of 4.1 tests # Loading