Skip to content

Commit 78d21a9

Browse files
author
Tor Didriksen
committed
Bug#25474239 MISC MTR TESTS FAIL WHEN CHANGING DEFAULT CHARACTER SET FOR DATABASE
Patch #6 To repeat: ./mtr --mem --charset-for-testdb=utf8mb4 join_cache_bka join_cache_bka_nixbnl join_cache_bkaunique join_cache_bnl join_cache_nojb binary join Fix: re-record with explicit charset for queries/tables with mismatch in explain output. Change-Id: I3e40a721f21dba14da362e2aba7a3935f7fc7627
1 parent acf9fde commit 78d21a9

10 files changed

+89
-89
lines changed

mysql-test/include/join_cache.inc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ CREATE TABLE t4(
328328
priority int NOT NULL default '0',
329329
canaddtocapability char(1) NOT NULL default 'Y',
330330
PRIMARY KEY (formatid)
331-
);
331+
) charset utf8mb4;
332332
CREATE INDEX t4_formatclassid ON t4(formatclassid);
333333
CREATE INDEX t4_formats_idx ON t4(canaddtocapability);
334334
INSERT INTO t4 VALUES
@@ -892,7 +892,7 @@ CREATE TABLE t5 (
892892
id2 bigint(20) NOT NULL DEFAULT '0',
893893
enum2 enum('Active','Deleted','Paused') DEFAULT NULL,
894894
PRIMARY KEY (id1,id2)
895-
);
895+
) charset utf8mb4;
896896

897897
--disable_query_log
898898
--disable_result_log
@@ -1501,10 +1501,10 @@ INSERT INTO t1 VALUES (NULL),(NULL);
15011501
DROP TABLE t1,t2;
15021502

15031503
# test varchar keys
1504-
CREATE TABLE t1 (b varchar(100));
1504+
CREATE TABLE t1 (b varchar(100)) charset utf8mb4;
15051505
INSERT INTO t1 VALUES (NULL),("some varchar");
15061506

1507-
CREATE TABLE t2 (a int, b varchar(100), KEY (b));
1507+
CREATE TABLE t2 (a int, b varchar(100), KEY (b)) charset utf8mb4;
15081508
INSERT INTO t2 VALUES (100,NULL),(150,"varchar"),(200,NULL),(250,"long long varchar");
15091509

15101510
explain SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b;
@@ -1792,15 +1792,15 @@ CREATE TABLE t1 ( col_int_key int(11) NOT NULL,
17921792
col_varchar_key varchar(1) NOT NULL,
17931793
KEY col_int_key (col_int_key),
17941794
KEY col_varchar_key (col_varchar_key,col_int_key)
1795-
) ENGINE=innodb;
1795+
) charset utf8mb4 ENGINE=innodb;
17961796

17971797
INSERT INTO t1 VALUES (0,'j'),(4,'b'),(4,'d');
17981798

17991799
CREATE TABLE t2 (
18001800
col_datetime_key datetime NOT NULL,
18011801
col_varchar_key varchar(1) NOT NULL,
18021802
KEY col_varchar_key (col_varchar_key)
1803-
) ENGINE=innodb;
1803+
) charset utf8mb4 ENGINE=innodb;
18041804

18051805
INSERT INTO t2 VALUES ('2003-08-21 00:00:00','b');
18061806

@@ -2038,7 +2038,7 @@ CREATE TABLE t2 (
20382038
col_datetime_nokey datetime NOT NULL,
20392039
col_varchar_key varchar(1),
20402040
KEY col_varchar_key (col_varchar_key)
2041-
);
2041+
) charset utf8mb4;
20422042

20432043
INSERT INTO t2 VALUES (9, '2002-08-25 20:35:06', 'e'),
20442044
(9, '2002-08-25 20:35:06', 'e');

mysql-test/r/binary.result

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
drop table if exists t1,t2;
2-
create table t1 (name char(20) not null, primary key (name));
2+
create table t1 (name char(20) not null, primary key (name)) charset latin1;
33
create table t2 (name char(20) binary not null, primary key (name));
44
insert into t1 values ("�");
55
insert into t1 values ("�");
@@ -43,7 +43,7 @@ name
4343
select name from t2 where name between '�' and '�';
4444
name
4545
drop table t1,t2;
46-
create table t1 (a char(10) not null, b char(10) binary not null,key (a), key(b));
46+
create table t1 (a char(10) not null, b char(10) binary not null,key (a), key(b)) charset latin1;
4747
insert into t1 values ("hello ","hello "),("hello2 ","hello2 ");
4848
select concat("-",a,"-",b,"-") from t1 where a="hello";
4949
concat("-",a,"-",b,"-")
@@ -85,7 +85,7 @@ NULL
8585
select b from t1 having binary b like '';
8686
b
8787
drop table t1;
88-
create table t1 (a char(3) binary, b binary(3));
88+
create table t1 (a char(3) binary, b binary(3)) charset latin1;
8989
insert into t1 values ('aaa','bbb'),('AAA','BBB');
9090
select upper(a),upper(b) from t1;
9191
upper(a) upper(b)
@@ -134,12 +134,12 @@ select * from t1 where firstname='john' and firstname like binary 'John';
134134
firstname lastname
135135
John Doe
136136
drop table t1;
137-
create table t1 (a binary);
137+
create table t1 (a binary) charset utf8mb4;
138138
show create table t1;
139139
Table Create Table
140140
t1 CREATE TABLE `t1` (
141141
`a` binary(1) DEFAULT NULL
142-
) ENGINE=ENGINE DEFAULT CHARSET=latin1
142+
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4
143143
drop table t1;
144144
create table t1 (col1 binary(4));
145145
insert into t1 values ('a'),('a ');

mysql-test/r/join.result

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,29 +1465,29 @@ col_date_key date DEFAULT NULL,
14651465
col_datetime datetime DEFAULT NULL,
14661466
PRIMARY KEY (pk),
14671467
KEY col_date_key (col_date_key)
1468-
) ENGINE=MyISAM;
1468+
) charset latin1 ENGINE=MyISAM;
14691469
INSERT INTO t1 VALUES
14701470
(8,9,'h','FDUMQ',-1356726272,'2007-09-02 05:48:23','she','2002-04-02','2002-12-20 17:54:07');
14711471
CREATE TABLE t2
14721472
(pk INT,
14731473
col_int INT DEFAULT NULL,
14741474
col_int_key INT DEFAULT NULL,
14751475
PRIMARY KEY (pk)
1476-
) ENGINE=MyISAM;
1476+
) charset latin1 ENGINE=MyISAM;
14771477
CREATE TABLE t3
14781478
(col_int INT DEFAULT NULL,
14791479
col_int_key INT DEFAULT NULL,
14801480
pk INT,
14811481
PRIMARY KEY (pk),
14821482
KEY test_idx (col_int_key,pk,col_int)
1483-
) ENGINE=InnoDB;
1483+
) charset latin1 ENGINE=InnoDB;
14841484
INSERT INTO t3 VALUES
14851485
(NULL,9, 41), (NULL,-1596719104, 48), (-1068105728,9, 49);
14861486
CREATE TABLE t4
14871487
(col_varchar_255_latin1_key VARCHAR(255) DEFAULT NULL,
14881488
pk INT,
14891489
PRIMARY KEY (pk)
1490-
) ENGINE=MyISAM;
1490+
) charset latin1 ENGINE=MyISAM;
14911491
INSERT INTO t4 VALUES ('RUXDY',8);
14921492
ANALYZE TABLE t1, t2, t3, t4;
14931493
Table Op Msg_type Msg_text

mysql-test/r/join_cache_bka.result

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ extension varchar(10) default NULL,
12391239
priority int NOT NULL default '0',
12401240
canaddtocapability char(1) NOT NULL default 'Y',
12411241
PRIMARY KEY (formatid)
1242-
);
1242+
) charset utf8mb4;
12431243
CREATE INDEX t4_formatclassid ON t4(formatclassid);
12441244
CREATE INDEX t4_formats_idx ON t4(canaddtocapability);
12451245
INSERT INTO t4 VALUES
@@ -1330,14 +1330,14 @@ id select_type table partitions type possible_keys key key_len ref rows filtered
13301330
1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.metaid 1 100.00 Using join buffer (Batched Key Access)
13311331
1 SIMPLE t7 NULL ref PRIMARY PRIMARY 4 test.t1.metaid 1 100.00 Using index
13321332
1 SIMPLE t8 NULL eq_ref PRIMARY PRIMARY 4 test.t7.artistid 1 100.00 Using join buffer (Batched Key Access)
1333-
1 SIMPLE t4 NULL ref PRIMARY,t4_formatclassid,t4_formats_idx t4_formats_idx 1 const 1 100.00 Using where; Using join buffer (Batched Key Access)
1333+
1 SIMPLE t4 NULL ref PRIMARY,t4_formatclassid,t4_formats_idx t4_formats_idx 4 const 1 100.00 Using where; Using join buffer (Batched Key Access)
13341334
1 SIMPLE t5 NULL eq_ref PRIMARY,t5_formattypeid PRIMARY 4 test.t4.formatclassid 1 50.00 Using where; Using join buffer (Batched Key Access)
13351335
1 SIMPLE t9 NULL ref PRIMARY,t9_subgenreid,t9_metaid t9_metaid 4 test.t1.metaid 2 100.00 Using join buffer (Batched Key Access)
13361336
1 SIMPLE t10 NULL eq_ref PRIMARY,t10_genreid PRIMARY 4 test.t9.subgenreid 1 100.00 Using join buffer (Batched Key Access)
13371337
1 SIMPLE t11 NULL eq_ref PRIMARY PRIMARY 4 test.t10.genreid 1 100.00 Using join buffer (Batched Key Access)
13381338
1 SIMPLE t3 NULL ref t3_metaid,t3_formatid,t3_metaidformatid t3_metaid 4 test.t1.metaid 2 100.00 Using where; Using join buffer (Batched Key Access)
13391339
Warnings:
1340-
Note 1003 /* select#1 */ select `test`.`t1`.`uniquekey` AS `uniquekey`,`test`.`t1`.`xml` AS `affiliateXml`,`test`.`t8`.`name` AS `artistName`,`test`.`t8`.`artistid` AS `artistid`,`test`.`t11`.`name` AS `genreName`,`test`.`t11`.`genreid` AS `genreid`,`test`.`t11`.`priority` AS `genrePriority`,`test`.`t10`.`subgenreid` AS `subgenreid`,`test`.`t10`.`name` AS `subgenreName`,`test`.`t2`.`name` AS `metaName`,`test`.`t2`.`metaid` AS `metaid`,`test`.`t2`.`xml` AS `metaXml`,((`test`.`t4`.`priority` + `test`.`t5`.`priority`) + '0') AS `overallPriority`,`test`.`t3`.`path` AS `path`,`test`.`t3`.`mediaid` AS `mediaid`,`test`.`t4`.`formatid` AS `formatid`,`test`.`t4`.`name` AS `formatName`,`test`.`t5`.`formatclassid` AS `formatclassid`,`test`.`t5`.`name` AS `formatclassName`,'2' AS `formattypeid`,'Ringtones' AS `formattypeName` from `test`.`t1` join `test`.`t2` join `test`.`t3` join `test`.`t4` join `test`.`t5` join `test`.`t7` join `test`.`t8` join `test`.`t9` join `test`.`t10` join `test`.`t11` where ((`test`.`t5`.`formattypeid` = 2) and (`test`.`t4`.`canaddtocapability` = 'Y') and (`test`.`t5`.`formatclassid` = `test`.`t4`.`formatclassid`) and (`test`.`t3`.`formatid` = `test`.`t4`.`formatid`) and (`test`.`t11`.`genreid` = `test`.`t10`.`genreid`) and (`test`.`t10`.`subgenreid` = `test`.`t9`.`subgenreid`) and (`test`.`t8`.`artistid` = `test`.`t7`.`artistid`) and (`test`.`t2`.`metaid` = `test`.`t1`.`metaid`) and (`test`.`t7`.`metaid` = `test`.`t1`.`metaid`) and (`test`.`t9`.`metaid` = `test`.`t1`.`metaid`) and (`test`.`t3`.`metaid` = `test`.`t1`.`metaid`) and (`test`.`t4`.`formatid` in (31,8,76)) and (`test`.`t1`.`affiliateid` = '2'))
1340+
Note 1003 /* select#1 */ select `test`.`t1`.`uniquekey` AS `uniquekey`,`test`.`t1`.`xml` AS `affiliateXml`,`test`.`t8`.`name` AS `artistName`,`test`.`t8`.`artistid` AS `artistid`,`test`.`t11`.`name` AS `genreName`,`test`.`t11`.`genreid` AS `genreid`,`test`.`t11`.`priority` AS `genrePriority`,`test`.`t10`.`subgenreid` AS `subgenreid`,`test`.`t10`.`name` AS `subgenreName`,`test`.`t2`.`name` AS `metaName`,`test`.`t2`.`metaid` AS `metaid`,`test`.`t2`.`xml` AS `metaXml`,((`test`.`t4`.`priority` + `test`.`t5`.`priority`) + '0') AS `overallPriority`,`test`.`t3`.`path` AS `path`,`test`.`t3`.`mediaid` AS `mediaid`,`test`.`t4`.`formatid` AS `formatid`,`test`.`t4`.`name` AS `formatName`,`test`.`t5`.`formatclassid` AS `formatclassid`,`test`.`t5`.`name` AS `formatclassName`,'2' AS `formattypeid`,'Ringtones' AS `formattypeName` from `test`.`t1` join `test`.`t2` join `test`.`t3` join `test`.`t4` join `test`.`t5` join `test`.`t7` join `test`.`t8` join `test`.`t9` join `test`.`t10` join `test`.`t11` where ((`test`.`t5`.`formattypeid` = 2) and (`test`.`t5`.`formatclassid` = `test`.`t4`.`formatclassid`) and (`test`.`t3`.`formatid` = `test`.`t4`.`formatid`) and (`test`.`t11`.`genreid` = `test`.`t10`.`genreid`) and (`test`.`t10`.`subgenreid` = `test`.`t9`.`subgenreid`) and (`test`.`t8`.`artistid` = `test`.`t7`.`artistid`) and (`test`.`t2`.`metaid` = `test`.`t1`.`metaid`) and (`test`.`t7`.`metaid` = `test`.`t1`.`metaid`) and (`test`.`t9`.`metaid` = `test`.`t1`.`metaid`) and (`test`.`t3`.`metaid` = `test`.`t1`.`metaid`) and (`test`.`t4`.`canaddtocapability` = 'Y') and (`test`.`t4`.`formatid` in (31,8,76)) and (`test`.`t1`.`affiliateid` = '2'))
13411341
SELECT t1.uniquekey, t1.xml AS affiliateXml,
13421342
t8.name AS artistName, t8.artistid,
13431343
t11.name AS genreName, t11.genreid, t11.priority AS genrePriority,
@@ -1906,7 +1906,7 @@ id1 bigint(20) NOT NULL DEFAULT '0',
19061906
id2 bigint(20) NOT NULL DEFAULT '0',
19071907
enum2 enum('Active','Deleted','Paused') DEFAULT NULL,
19081908
PRIMARY KEY (id1,id2)
1909-
);
1909+
) charset utf8mb4;
19101910
set join_buffer_size=2048;
19111911
EXPLAIN
19121912
SELECT STRAIGHT_JOIN t1.id1, t1.num3, t3.text1, t3.id4, t2.id3, t4.dummy
@@ -1920,7 +1920,7 @@ id select_type table partitions type possible_keys key key_len ref rows filtered
19201920
1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 8 test.t1.id2 1 100.00 Using join buffer (Batched Key Access)
19211921
1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 16 test.t1.id1,test.t1.id2 1 33.33 Using where; Using join buffer (Batched Key Access)
19221922
Warnings:
1923-
Note 1003 /* select#1 */ select straight_join `test`.`t1`.`id1` AS `id1`,`test`.`t1`.`num3` AS `num3`,`test`.`t3`.`text1` AS `text1`,`test`.`t3`.`id4` AS `id4`,`test`.`t2`.`id3` AS `id3`,`test`.`t4`.`dummy` AS `dummy` from `test`.`t1` join `test`.`t2` join `test`.`t3` join `test`.`t4` join `test`.`t5` where ((`test`.`t2`.`id3` = `test`.`t1`.`id3`) and (`test`.`t3`.`id4` = `test`.`t2`.`id4`) and (`test`.`t5`.`enum2` = 'Active') and (`test`.`t4`.`id2` = `test`.`t1`.`id2`) and (`test`.`t5`.`id2` = `test`.`t1`.`id2`) and (`test`.`t5`.`id1` = `test`.`t1`.`id1`) and (`test`.`t3`.`text1` < 'D'))
1923+
Note 1003 /* select#1 */ select straight_join `test`.`t1`.`id1` AS `id1`,`test`.`t1`.`num3` AS `num3`,`test`.`t3`.`text1` AS `text1`,`test`.`t3`.`id4` AS `id4`,`test`.`t2`.`id3` AS `id3`,`test`.`t4`.`dummy` AS `dummy` from `test`.`t1` join `test`.`t2` join `test`.`t3` join `test`.`t4` join `test`.`t5` where ((`test`.`t2`.`id3` = `test`.`t1`.`id3`) and (`test`.`t3`.`id4` = `test`.`t2`.`id4`) and (`test`.`t4`.`id2` = `test`.`t1`.`id2`) and (`test`.`t5`.`id2` = `test`.`t1`.`id2`) and (`test`.`t5`.`id1` = `test`.`t1`.`id1`) and (`test`.`t5`.`enum2` = 'Active') and (`test`.`t3`.`text1` < 'D'))
19241924
SELECT STRAIGHT_JOIN t1.id1, t1.num3, t3.text1, t3.id4, t2.id3, t4.dummy
19251925
FROM t1 JOIN t2 JOIN t3 JOIN t4 JOIN t5
19261926
WHERE t1.id1=t5.id1 AND t1.id2=t5.id2 and t4.id2=t1.id2 AND
@@ -2220,9 +2220,9 @@ a
22202220
NULL
22212221
NULL
22222222
DROP TABLE t1,t2;
2223-
CREATE TABLE t1 (b varchar(100));
2223+
CREATE TABLE t1 (b varchar(100)) charset utf8mb4;
22242224
INSERT INTO t1 VALUES (NULL),("some varchar");
2225-
CREATE TABLE t2 (a int, b varchar(100), KEY (b));
2225+
CREATE TABLE t2 (a int, b varchar(100), KEY (b)) charset utf8mb4;
22262226
INSERT INTO t2 VALUES (100,NULL),(150,"varchar"),(200,NULL),(250,"long long varchar");
22272227
explain SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b;
22282228
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
@@ -2544,13 +2544,13 @@ CREATE TABLE t1 ( col_int_key int(11) NOT NULL,
25442544
col_varchar_key varchar(1) NOT NULL,
25452545
KEY col_int_key (col_int_key),
25462546
KEY col_varchar_key (col_varchar_key,col_int_key)
2547-
) ENGINE=innodb;
2547+
) charset utf8mb4 ENGINE=innodb;
25482548
INSERT INTO t1 VALUES (0,'j'),(4,'b'),(4,'d');
25492549
CREATE TABLE t2 (
25502550
col_datetime_key datetime NOT NULL,
25512551
col_varchar_key varchar(1) NOT NULL,
25522552
KEY col_varchar_key (col_varchar_key)
2553-
) ENGINE=innodb;
2553+
) charset utf8mb4 ENGINE=innodb;
25542554
INSERT INTO t2 VALUES ('2003-08-21 00:00:00','b');
25552555
explain SELECT MIN(t2.col_datetime_key) AS field1,
25562556
t1.col_int_key AS field2
@@ -2560,8 +2560,8 @@ ON t1.col_varchar_key = t2.col_varchar_key
25602560
GROUP BY field2
25612561
ORDER BY field1;
25622562
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2563-
1 SIMPLE t1 NULL index col_int_key,col_varchar_key col_varchar_key 7 NULL 3 100.00 Using index; Using temporary; Using filesort
2564-
1 SIMPLE t2 NULL ref col_varchar_key col_varchar_key 3 test.t1.col_varchar_key 1 100.00 Using join buffer (Batched Key Access)
2563+
1 SIMPLE t1 NULL index col_int_key,col_varchar_key col_varchar_key 10 NULL 3 100.00 Using index; Using temporary; Using filesort
2564+
1 SIMPLE t2 NULL ref col_varchar_key col_varchar_key 6 test.t1.col_varchar_key 1 100.00 Using join buffer (Batched Key Access)
25652565
Warnings:
25662566
Note 1003 /* select#1 */ select min(`test`.`t2`.`col_datetime_key`) AS `field1`,`test`.`t1`.`col_int_key` AS `field2` from `test`.`t1` left join `test`.`t2` FORCE INDEX (`col_varchar_key`) on((`test`.`t2`.`col_varchar_key` = `test`.`t1`.`col_varchar_key`)) where 1 group by `field2` order by `field1`
25672567
SELECT MIN(t2.col_datetime_key) AS field1,
@@ -2823,7 +2823,7 @@ col_int_nokey int,
28232823
col_datetime_nokey datetime NOT NULL,
28242824
col_varchar_key varchar(1),
28252825
KEY col_varchar_key (col_varchar_key)
2826-
);
2826+
) charset utf8mb4;
28272827
INSERT INTO t2 VALUES (9, '2002-08-25 20:35:06', 'e'),
28282828
(9, '2002-08-25 20:35:06', 'e');
28292829
set @optimizer_switch_saved=@@session.optimizer_switch;
@@ -2838,7 +2838,7 @@ AND t1.col_int_nokey IS NULL )
28382838
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
28392839
1 PRIMARY parent1 NULL ALL NULL NULL NULL NULL 2 100.00 NULL
28402840
1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (Block Nested Loop)
2841-
2 DEPENDENT SUBQUERY child1 NULL index_subquery col_varchar_key col_varchar_key 4 func 2 100.00 Using where; Using index
2841+
2 DEPENDENT SUBQUERY child1 NULL index_subquery col_varchar_key col_varchar_key 7 func 2 100.00 Using where; Using index
28422842
Warnings:
28432843
Note 1276 Field or reference 'test.parent1.col_datetime_nokey' of SELECT #2 was resolved in SELECT #1
28442844
Note 1276 Field or reference 'test.t1.col_int_nokey' of SELECT #2 was resolved in SELECT #1

0 commit comments

Comments
 (0)