Skip to content

Commit

Permalink
Merge 10.4 into 10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Aug 30, 2022
2 parents 0324bde + 7e574eb commit 29fa9bc
Show file tree
Hide file tree
Showing 16 changed files with 341 additions and 38 deletions.
116 changes: 116 additions & 0 deletions mysql-test/main/subselect4.result
Original file line number Diff line number Diff line change
Expand Up @@ -3042,6 +3042,122 @@ a
3
2
drop table t1,t2,t3;
#
# MDEV-29139: Redundant IN/ALL/ANY predicand in GROUP BY clause of
# IN/ALL/ANY/EXISTS subquery
#
create table t1 (a int);
create table t2 (b int);
create table t3 (c int);
create table t4 (d int);
insert into t1 values (3), (1);
insert into t2 values (3), (2);
insert into t3 values (4), (2);
insert into t4 values (1), (7);
explain extended select b from t2
where exists (select c from t3
group by (select a from t1 where a = 1) in (select d from t4));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where 1
select b from t2
where exists (select c from t3
group by (select a from t1 where a = 1) in (select d from t4));
b
3
2
prepare stmt from "select b from t2
where exists (select c from t3
group by (select a from t1 where a = 1) in (select d from t4))";
execute stmt;
b
3
2
execute stmt;
b
3
2
deallocate prepare stmt;
explain extended select b from t2
where exists (select c from t3
group by (select a from t1 where a = 1) >=
any (select d from t4));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where 1
select b from t2
where exists (select c from t3
group by (select a from t1 where a = 1) >=
any (select d from t4));
b
3
2
explain extended select b from t2
where exists (select c from t3
group by (select a from t1 where a = 1) <
all (select d from t4));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where 1
select b from t2
where exists (select c from t3
group by (select a from t1 where a = 1) <
all (select d from t4));
b
3
2
explain extended select b from t2
where b in (select c from t3
group by (select a from t1 where a = 1) in (select d from t4));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 select `test`.`t2`.`b` AS `b` from `test`.`t2` semi join (`test`.`t3`) where 1
select b from t2
where b in (select c from t3
group by (select a from t1 where a = 1) in (select d from t4));
b
2
explain extended select b from t2
where b >= any (select c from t3
group by (select a from t1 where a = 1) in
(select d from t4));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where <nop>(<in_optimizer>(`test`.`t2`.`b`,(/* select#2 */ select min(`test`.`t3`.`c`) from `test`.`t3`) <= <cache>(`test`.`t2`.`b`)))
select b from t2
where b >= any (select c from t3
group by (select a from t1 where a = 1) in
(select d from t4));
b
3
2
explain extended select b from t2
where b <= all (select c from t3
group by (select a from t1 where a = 1) in
(select d from t4));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where <not>(<in_optimizer>(`test`.`t2`.`b`,<min>(/* select#2 */ select `test`.`t3`.`c` from `test`.`t3`) < <cache>(`test`.`t2`.`b`)))
select b from t2
where b <= all (select c from t3
group by (select a from t1 where a = 1) in
(select d from t4));
b
2
drop table t1,t2,t3,t4;
# End of 10.3 tests
#
# MDEV-19134: EXISTS() slower if ORDER BY is defined
Expand Down
74 changes: 74 additions & 0 deletions mysql-test/main/subselect4.test
Original file line number Diff line number Diff line change
Expand Up @@ -2479,6 +2479,80 @@ eval $q3;

drop table t1,t2,t3;

--echo #
--echo # MDEV-29139: Redundant IN/ALL/ANY predicand in GROUP BY clause of
--echo # IN/ALL/ANY/EXISTS subquery
--echo #

create table t1 (a int);
create table t2 (b int);
create table t3 (c int);
create table t4 (d int);

insert into t1 values (3), (1);
insert into t2 values (3), (2);
insert into t3 values (4), (2);
insert into t4 values (1), (7);

let $q1=
select b from t2
where exists (select c from t3
group by (select a from t1 where a = 1) in (select d from t4));

eval explain extended $q1;
eval $q1;

eval prepare stmt from "$q1";
execute stmt;
execute stmt;
deallocate prepare stmt;

let $q2=
select b from t2
where exists (select c from t3
group by (select a from t1 where a = 1) >=
any (select d from t4));

eval explain extended $q2;
eval $q2;

let $q3=
select b from t2
where exists (select c from t3
group by (select a from t1 where a = 1) <
all (select d from t4));

eval explain extended $q3;
eval $q3;

let $q4=
select b from t2
where b in (select c from t3
group by (select a from t1 where a = 1) in (select d from t4));

eval explain extended $q4;
eval $q4;

let $q5=
select b from t2
where b >= any (select c from t3
group by (select a from t1 where a = 1) in
(select d from t4));

eval explain extended $q5;
eval $q5;

let $q6=
select b from t2
where b <= all (select c from t3
group by (select a from t1 where a = 1) in
(select d from t4));

eval explain extended $q6;
eval $q6;

drop table t1,t2,t3,t4;

--echo # End of 10.3 tests

--echo #
Expand Down
17 changes: 16 additions & 1 deletion mysql-test/suite/innodb/r/foreign_key_not_windows.result
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ CREATE TABLE `d255`.`_##################################################`
ERROR HY000: Long database name and identifier for object resulted in path length exceeding 512 characters. Path: './@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023/_@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023
CREATE TABLE `d255`.`##################################################`
(a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB;
#
# MDEV-29258 Failing assertion for name length on RENAME TABLE
#
CREATE TABLE `d255`.`d245` (x INT) ENGINE=InnoDB;
DROP TABLE `d255`.`d250`;
RENAME TABLE `d250#`.`d245` TO `d250#`.`d250`;
RENAME TABLE `d255`.`d250` TO a;
DROP TABLE a,t;
#
# MDEV-29409 Buffer overflow in my_wc_mb_filename() on RENAME TABLE
#
CREATE TABLE `d255`.t(a INT PRIMARY KEY)ENGINE=InnoDB;
CREATE TABLE `d255`.u(a INT PRIMARY KEY,
CONSTRAINT `d320` FOREIGN KEY (a) REFERENCES `d255`.t (a)) ENGINE=InnoDB;
RENAME TABLE `d255`.u TO u;
DROP TABLE u;
DROP DATABASE `d255`;
DROP TABLE t;
# End of 10.3 tests
34 changes: 33 additions & 1 deletion mysql-test/suite/innodb/t/foreign_key_not_windows.test
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,40 @@ eval CREATE TABLE `$d255`.`_$d250`
--replace_result $d255 d255
eval CREATE TABLE `$d255`.`$d250`
(a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB;

--echo #
--echo # MDEV-29258 Failing assertion for name length on RENAME TABLE
--echo #

let $d245=-------------------------------------------------;
--replace_result $d245 d245 $d255 d255
eval CREATE TABLE `$d255`.`$d245` (x INT) ENGINE=InnoDB;
--replace_result $d250 d250 $d255 d255
eval DROP TABLE `$d255`.`$d250`;

--replace_result $d245 d245 $d250 d250 d255 d255
eval RENAME TABLE `$d255`.`$d245` TO `$d255`.`$d250`;
--replace_result $d250 d250 $d255 d255
eval RENAME TABLE `$d255`.`$d250` TO a;
--replace_result $d255 d255
DROP TABLE a,t;

--echo #
--echo # MDEV-29409 Buffer overflow in my_wc_mb_filename() on RENAME TABLE
--echo #

let $d225=#############################################;
let $d320=################################################################;

--replace_result $d255 d255
eval CREATE TABLE `$d255`.t(a INT PRIMARY KEY)ENGINE=InnoDB;
--replace_result $d255 d255 $d320 d320
eval CREATE TABLE `$d255`.u(a INT PRIMARY KEY,
CONSTRAINT `$d320` FOREIGN KEY (a) REFERENCES `$d255`.t (a)) ENGINE=InnoDB;
--replace_result $d255 d255
eval RENAME TABLE `$d255`.u TO u;
DROP TABLE u;
--replace_result $d255 d255
eval DROP DATABASE `$d255`;
DROP TABLE t;

--echo # End of 10.3 tests
4 changes: 2 additions & 2 deletions mysql-test/suite/innodb/t/innodb_sys_semaphore_waits.test
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ let $counter= 80;
let $mysql_errno= 0;
while (!$mysql_errno)
{
--error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013
--error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013,5014
show status;

--error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013
--error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013,5014
select * from information_schema.innodb_sys_semaphore_waits;

dec $counter;
Expand Down
36 changes: 20 additions & 16 deletions mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
INSTALL PLUGIN simple_parser SONAME 'mypluglib';
FLUSH TABLES;
# Test Part 1: Grammar Test
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
Expand Down Expand Up @@ -31,7 +32,7 @@ INSERT INTO articles (title, body) VALUES
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
MATCH(title, body) AGAINST('mysql') ORDER BY id;
id title body
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
2 How To Use MySQL Well After you went through a ...
Expand Down Expand Up @@ -68,7 +69,7 @@ INSERT INTO articles (title, body) VALUES
('Go MySQL Tricks','How to use full text search engine');
ALTER TABLE articles ADD FULLTEXT INDEX (title, body) WITH PARSER simple_parser;
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
MATCH(title, body) AGAINST('mysql') ORDER BY id;
id title body
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
2 How To Use MySQL Well After you went through a ...
Expand All @@ -88,21 +89,23 @@ MATCH(title, body) AGAINST('full text');
id title body
5 Go MySQL Tricks How to use full text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION);
MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION)
ORDER BY id;
id title body
4 1001 MySQL Tricks How to use full-text search engine
5 Go MySQL Tricks How to use full text search engine
2 How To Use MySQL Well After you went through a ...
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
2 How To Use MySQL Well After you went through a ...
3 Optimizing MySQL In this tutorial we will show ...
4 1001 MySQL Tricks How to use full-text search engine
5 Go MySQL Tricks How to use full text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION);
MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION)
ORDER BY id;
id title body
5 Go MySQL Tricks How to use full text search engine
4 1001 MySQL Tricks How to use full-text search engine
2 How To Use MySQL Well After you went through a ...
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
2 How To Use MySQL Well After you went through a ...
3 Optimizing MySQL In this tutorial we will show ...
4 1001 MySQL Tricks How to use full-text search engine
5 Go MySQL Tricks How to use full text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE);
id title body
Expand Down Expand Up @@ -137,27 +140,27 @@ INSERT INTO articles (title, body) VALUES
('Go MariaDB Tricks','How to use full text search engine');
# restart
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('MySQL');
MATCH(title, body) AGAINST('MySQL') ORDER BY id;
id title body
6 MySQL Tutorial DBMS stands for MySQL DataBase ...
7 How To Use MySQL Well After you went through a ...
8 Optimizing MySQL In this tutorial we will show ...
9 1001 MySQL Tricks How to use full-text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('tutorial');
MATCH(title, body) AGAINST('tutorial') ORDER BY id;
id title body
6 MySQL Tutorial DBMS stands for MySQL DataBase ...
8 Optimizing MySQL In this tutorial we will show ...
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('Tricks');
MATCH(title, body) AGAINST('Tricks') ORDER BY id;
id title body
9 1001 MySQL Tricks How to use full-text search engine
10 Go MariaDB Tricks How to use full text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text search');
MATCH(title, body) AGAINST('full text search') ORDER BY id;
id title body
10 Go MariaDB Tricks How to use full text search engine
9 1001 MySQL Tricks How to use full-text search engine
10 Go MariaDB Tricks How to use full text search engine
SELECT COUNT(*) FROM articles;
COUNT(*)
5
Expand Down Expand Up @@ -185,7 +188,8 @@ UNINSTALL PLUGIN simple_parser;
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
MATCH(title, body) AGAINST('mysql')
ORDER BY id;
id title body
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
2 How To Use MySQL Well After you went through a ...
Expand Down
Loading

0 comments on commit 29fa9bc

Please sign in to comment.