Skip to content

Commit 6823935

Browse files
author
Tor Didriksen
committed
Bug#25505150 SUBQUERY_XXX TESTS FAIL WHEN CHANGING DEFAULT CHARACTER SET
To repeat: ./mtr --mem --charset-for-testdb=utf8mb4 Fix for: subquery_all subquery_all_bka subquery_all_bka_nixbnl subquery_nomat_nosj subquery_nomat_nosj_bka subquery_nomat_nosj_bka_nixbnl subquery_none subquery_none_bka subquery_none_bka_nixbnl
1 parent a2248f1 commit 6823935

10 files changed

+333
-328
lines changed

mysql-test/include/subquery.inc

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -615,18 +615,18 @@ select * from t1;
615615
drop table t1, t2, t3;
616616

617617
SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
618-
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT 1)) a;
618+
CREATE TABLE t1 charset utf8mb4 SELECT * FROM (SELECT 1 as a,(SELECT 1)) a;
619619
SHOW CREATE TABLE t1;
620620
drop table t1;
621-
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
621+
CREATE TABLE t1 charset utf8mb4 SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
622622
SHOW CREATE TABLE t1;
623623
DROP TABLE t1;
624624

625-
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a;
625+
CREATE TABLE t1 charset utf8mb4 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a;
626626
SHOW CREATE TABLE t1;
627627
DROP TABLE t1;
628628

629-
CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a;
629+
CREATE TABLE t1 charset utf8mb4 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a;
630630
select * from t1;
631631
SHOW CREATE TABLE t1;
632632
drop table t1;
@@ -878,9 +878,14 @@ select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
878878
select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
879879
select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
880880
select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
881+
# Ignore possible changes in key_len for different character sets
882+
--replace_column 8 6
881883
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
884+
--replace_column 8 6
882885
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
886+
--replace_column 8 6
883887
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
888+
--replace_column 8 6
884889
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
885890
drop table t1,t2;
886891

@@ -1864,7 +1869,7 @@ drop table t1;
18641869
create table t1(a int, primary key (a));
18651870
insert into t1 values (10);
18661871

1867-
create table t2 (a int primary key, b varchar(32), c int, unique key b(c, b));
1872+
create table t2 (a int primary key, b varchar(32), c int, unique key b(c, b)) charset utf8mb4;
18681873
insert into t2(a, c, b) values (1,10,'359'), (2,10,'35988'), (3,10,'35989');
18691874

18701875
explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
@@ -1946,12 +1951,12 @@ DROP TABLE t1,t2;
19461951
CREATE TABLE t1 (a DATETIME);
19471952
INSERT INTO t1 VALUES ('1998-09-23'), ('2003-03-25');
19481953

1949-
CREATE TABLE t2 AS SELECT
1954+
CREATE TABLE t2 charset utf8mb4 AS SELECT
19501955
(SELECT a FROM t1 WHERE a < '2000-01-01') AS sub_a
19511956
FROM t1 WHERE a > '2000-01-01';
19521957
SHOW CREATE TABLE t2;
19531958

1954-
CREATE TABLE t3 AS (SELECT a FROM t1 WHERE a < '2000-01-01') UNION (SELECT a FROM t1 WHERE a > '2000-01-01');
1959+
CREATE TABLE t3 charset utf8mb4 AS (SELECT a FROM t1 WHERE a < '2000-01-01') UNION (SELECT a FROM t1 WHERE a > '2000-01-01');
19551960
SHOW CREATE TABLE t3;
19561961

19571962
DROP TABLE t1,t2,t3;
@@ -2889,7 +2894,7 @@ DROP TABLE t1;
28892894
#
28902895

28912896
CREATE TABLE t1 (
2892-
a varchar(255) default NULL,
2897+
a varchar(200) default NULL,
28932898
b timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
28942899
INDEX idx(a,b)
28952900
);
@@ -3510,7 +3515,7 @@ select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) z from t
35103515
drop table t1, t2;
35113516

35123517
# Now test different column types:
3513-
create table t1 (oref char(4), grp int, ie int);
3518+
create table t1 (oref char(4), grp int, ie int) charset utf8mb4;
35143519
insert into t1 (oref, grp, ie) values
35153520
('aa', 10, 2),
35163521
('aa', 10, 1),
@@ -3527,7 +3532,7 @@ insert into t1 (oref, grp, ie) values
35273532
('ff', 20, 2),
35283533
('ff', 20, 1);
35293534

3530-
create table t2 (oref char(4), a int);
3535+
create table t2 (oref char(4), a int) charset utf8mb4;
35313536
insert into t2 values
35323537
('ee', NULL),
35333538
('bb', 2),
@@ -5484,10 +5489,10 @@ DROP TABLE t1, t2;
54845489
--echo # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
54855490
--echo #
54865491

5487-
CREATE TABLE t1 (f1 varchar(1));
5492+
CREATE TABLE t1 (f1 varchar(1)) charset utf8mb4;
54885493
INSERT INTO t1 VALUES ('v'),('s');
54895494

5490-
CREATE TABLE t2 (f1_key varchar(1), KEY (f1_key));
5495+
CREATE TABLE t2 (f1_key varchar(1), KEY (f1_key)) charset utf8mb4;
54915496
INSERT INTO t2 VALUES ('j'),('v'),('c'),('m'),('d'),
54925497
('d'),('y'),('t'),('d'),('s');
54935498

@@ -5513,15 +5518,15 @@ col_int_key int,
55135518
col_varchar_key varchar(1),
55145519
col_varchar_nokey varchar(1),
55155520
KEY (col_int_key)
5516-
);
5521+
) charset latin1;
55175522
INSERT INTO t1 VALUES (224,'p','p'),(9,'e','e');
55185523

55195524
CREATE TABLE t3 (
55205525
col_int_key int,
55215526
col_varchar_key varchar(1),
55225527
KEY col_int_key (col_int_key),
55235528
KEY col_varchar_key (col_varchar_key,col_int_key))
5524-
;
5529+
charset latin1;
55255530
INSERT INTO t3 VALUES (4,'p'),(8,'e'),(10,'a');
55265531

55275532
# At jcl>=1, if join buffering is on t1 bug doesn't happen, so we
@@ -5575,15 +5580,15 @@ DROP TABLE t1, t2, t3;
55755580
CREATE TABLE ot (
55765581
col_int_nokey int(11),
55775582
col_varchar_nokey varchar(1)
5578-
) ;
5583+
) charset latin1;
55795584

55805585
INSERT INTO ot VALUES (1,'x');
55815586

55825587
CREATE TABLE it (
55835588
col_int_key int(11),
55845589
col_varchar_key varchar(1),
55855590
KEY idx_cvk_cik (col_varchar_key,col_int_key)
5586-
) ;
5591+
) charset latin1 ;
55875592

55885593
INSERT INTO it VALUES (NULL,'x'), (NULL,'f');
55895594

@@ -5629,7 +5634,7 @@ CREATE TABLE it (
56295634
col_varchar_key2 varchar(1),
56305635
KEY idx_cvk_cvk2_cik (col_varchar_key, col_varchar_key2, col_int_key),
56315636
KEY idx_cvk_cik (col_varchar_key, col_int_key)
5632-
);
5637+
) charset latin1;
56335638

56345639
INSERT INTO it VALUES (NULL,'x','x'), (NULL,'f','f');
56355640

@@ -5682,7 +5687,7 @@ CREATE TABLE t1 (
56825687
PRIMARY KEY (pk),
56835688
KEY col_int_key (col_int_key),
56845689
KEY col_varchar_key (col_varchar_key,col_int_key)
5685-
);
5690+
) charset latin1;
56865691

56875692
INSERT INTO t1 VALUES (1,0,'j','j'),(2,8,'v','v'),
56885693
(3,1,'c','c'),(4,8,'m','m'),(5,9,'d','d');
@@ -5920,7 +5925,7 @@ CREATE TABLE t1 (
59205925
col_varchar_key varchar(1) NOT NULL,
59215926
col_varchar_nokey varchar(1) NOT NULL,
59225927
KEY col_varchar_key (col_varchar_key)
5923-
) ENGINE=InnoDB;
5928+
) charset utf8mb4 ENGINE=InnoDB;
59245929

59255930
INSERT INTO t1 VALUES
59265931
('v','v'), ('s','s'), ('l','l'), ('y','y'), ('c','c'),
@@ -5931,7 +5936,7 @@ INSERT INTO t1 VALUES
59315936
CREATE TABLE t2 (
59325937
col_int_nokey INT NOT NULL,
59335938
col_varchar_nokey varchar(1) NOT NULL
5934-
) ENGINE=InnoDB;
5939+
) charset utf8mb4 ENGINE=InnoDB;
59355940

59365941
INSERT INTO t2 VALUES
59375942
(4,'j'), (6,'v'), (3,'c'), (5,'m'), (3,'d'), (246,'d'), (2,'y'), (9,'t'),
@@ -6674,11 +6679,11 @@ CREATE TABLE t1 (
66746679
a1 char(8) DEFAULT NULL,
66756680
a2 char(8) DEFAULT NULL,
66766681
KEY a1 (a1(2))
6677-
);
6682+
) charset latin1;
66786683
CREATE TABLE t2 (
66796684
b1 char(8) DEFAULT NULL,
66806685
b2 char(8) DEFAULT NULL
6681-
);
6686+
) charset latin1;
66826687
INSERT INTO t1 VALUES
66836688
('1 - 00', '2 - 00'),('1 - 01', '2 - 01'),('1 - 02', '2 - 02');
66846689
INSERT INTO t2 VALUES

0 commit comments

Comments
 (0)