Skip to content

Commit 478b830

Browse files
committed
Merge branch '10.3' into 10.4
2 parents 0aa0256 + 043bd85 commit 478b830

File tree

112 files changed

+1838
-1257
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+1838
-1257
lines changed

extra/mariabackup/xtrabackup.cc

+4
Original file line numberDiff line numberDiff line change
@@ -5776,6 +5776,10 @@ static bool xtrabackup_prepare_func(char** argv)
57765776
ut_ad(inc_dir_tables_hash);
57775777
}
57785778

5779+
msg("open files limit requested %u, set to %u",
5780+
(uint) xb_open_files_limit,
5781+
xb_set_max_open_files(xb_open_files_limit));
5782+
57795783
/* Fix DDL for prepare. Process .del,.ren, and .new files.
57805784
The order in which files are processed, is important
57815785
(see MDEV-18185, MDEV-18201)

include/mysql/plugin_ftparser.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@ typedef struct st_mysql_ftparser_boolean_info
158158
the word to MySQL full-text index. When parsing a search query,
159159
this function will add the new word to the list of words to search
160160
for. The boolean_info argument can be NULL for all cases except
161-
when mode is MYSQL_FTPARSER_FULL_BOOLEAN_INFO.
161+
when mode is MYSQL_FTPARSER_FULL_BOOLEAN_INFO. A plugin can replace this
162+
callback to post-process every parsed word before passing it to the original
163+
mysql_add_word function.
162164
163165
ftparser_state: A generic pointer. The plugin can set it to point
164166
to information to be used internally for its own purposes.

mysql-test/include/ctype_utf8mb4.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1587,7 +1587,7 @@ drop table t1;
15871587
--echo #
15881588
--echo # Check strnxfrm() with odd length
15891589
--echo #
1590-
set max_sort_length=9;
1590+
set max_sort_length=65;
15911591
select @@max_sort_length;
15921592
eval create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci) engine $engine;
15931593
insert into t1 values ('a'),('b'),('c');

mysql-test/main/brackets.result

+6-6
Original file line numberDiff line numberDiff line change
@@ -4397,7 +4397,7 @@ with t as (select * from t1 where a <=3)
43974397
select * from t;
43984398
show create view v1;
43994399
View Create View character_set_client collation_connection
4400-
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `t1`.`a` AS `a` from `t1` where `t1`.`a` <= 3)select `t`.`a` AS `a` from `t` latin1 latin1_swedish_ci
4400+
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` <= 3)select `t`.`a` AS `a` from `t` latin1 latin1_swedish_ci
44014401
select * from v1;
44024402
a
44034403
3
@@ -4413,7 +4413,7 @@ order by a desc limit 3 )
44134413
select a from t1 where a=4 union select a from t where a=7;
44144414
show create view v1;
44154415
View Create View character_set_client collation_connection
4416-
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `t1`.`a` AS `a` from `t1` where `t1`.`a` < 3 union select `t1`.`a` AS `a` from `t1` where `t1`.`a` > 3 order by `a` desc limit 3)select `t1`.`a` AS `a` from `t1` where `t1`.`a` = 4 union select `t`.`a` AS `a` from `t` where `t`.`a` = 7 latin1 latin1_swedish_ci
4416+
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 3 order by `a` desc limit 3)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 4 union select `t`.`a` AS `a` from `t` where `t`.`a` = 7 latin1 latin1_swedish_ci
44174417
select * from v1;
44184418
a
44194419
4
@@ -4429,7 +4429,7 @@ order by a desc limit 3 )
44294429
(select a from t1 where a=4 union select a from t where a=7 order by a desc);
44304430
show create view v1;
44314431
View Create View character_set_client collation_connection
4432-
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as ((select `t1`.`a` AS `a` from `t1` where `t1`.`a` < 3) union (select `t1`.`a` AS `a` from `t1` where `t1`.`a` > 3) order by `a` desc limit 3)select `t1`.`a` AS `a` from `t1` where `t1`.`a` = 4 union select `t`.`a` AS `a` from `t` where `t`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci
4432+
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as ((select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3) union (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 3) order by `a` desc limit 3)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 4 union select `t`.`a` AS `a` from `t` where `t`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci
44334433
select * from v1;
44344434
a
44354435
7
@@ -4469,7 +4469,7 @@ order by 1 desc limit 3 )
44694469
select a from t1 where a=4 union select a from t where a=7 order by a desc;
44704470
show create view v1;
44714471
View Create View character_set_client collation_connection
4472-
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t(a) as (values (2),(1) union (values (4),(7)) order by 1 desc limit 3)select `t1`.`a` AS `a` from `t1` where `t1`.`a` = 4 union select `t`.`a` AS `a` from `t` where `t`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci
4472+
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t(a) as (values (2),(1) union (values (4),(7)) order by 1 desc limit 3)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 4 union select `t`.`a` AS `a` from `t` where `t`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci
44734473
select * from v1;
44744474
a
44754475
7
@@ -4484,7 +4484,7 @@ order by 1 desc limit 3 )
44844484
select a from t1 where a=1 union select a from t where a=7 order by a desc;
44854485
show create view v1;
44864486
View Create View character_set_client collation_connection
4487-
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t(a) as ((values (2),(1)) union (values (4),(7) order by 1 desc) order by 1 desc limit 3)select `t1`.`a` AS `a` from `t1` where `t1`.`a` = 1 union select `t`.`a` AS `a` from `t` where `t`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci
4487+
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t(a) as ((values (2),(1)) union (values (4),(7) order by 1 desc) order by 1 desc limit 3)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 union select `t`.`a` AS `a` from `t` where `t`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci
44884488
select * from v1;
44894489
a
44904490
7
@@ -4496,7 +4496,7 @@ s as (select * from t1 where a > 3)
44964496
select a from t where a=1 union select a from s where a=7 order by a desc;
44974497
show create view v1;
44984498
View Create View character_set_client collation_connection
4499-
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `t1`.`a` AS `a` from `t1` where `t1`.`a` < 3), s as (select `t1`.`a` AS `a` from `t1` where `t1`.`a` > 3)select `t`.`a` AS `a` from `t` where `t`.`a` = 1 union select `s`.`a` AS `a` from `s` where `s`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci
4499+
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3), s as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 3)select `t`.`a` AS `a` from `t` where `t`.`a` = 1 union select `s`.`a` AS `a` from `s` where `s`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci
45004500
select * from v1;
45014501
a
45024502
7

mysql-test/main/cte_nonrecursive.result

+39-4
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ with t as (select a from t1 where b >= 'c')
571571
select * from t2,t where t2.c=t.a;
572572
show create view v1;
573573
View Create View character_set_client collation_connection
574-
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `t1`.`a` AS `a` from `t1` where `t1`.`b` >= 'c')select `t2`.`c` AS `c`,`t`.`a` AS `a` from (`t2` join `t`) where `t2`.`c` = `t`.`a` latin1 latin1_swedish_ci
574+
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`b` >= 'c')select `test`.`t2`.`c` AS `c`,`t`.`a` AS `a` from (`test`.`t2` join `t`) where `test`.`t2`.`c` = `t`.`a` latin1 latin1_swedish_ci
575575
select * from v1;
576576
c a
577577
4 4
@@ -588,7 +588,7 @@ with t as (select a, count(*) from t1 where b >= 'c' group by a)
588588
select * from t2,t where t2.c=t.a;
589589
show create view v2;
590590
View Create View character_set_client collation_connection
591-
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS with t as (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` where `t1`.`b` >= 'c' group by `t1`.`a`)select `t2`.`c` AS `c`,`t`.`a` AS `a`,`t`.`count(*)` AS `count(*)` from (`t2` join `t`) where `t2`.`c` = `t`.`a` latin1 latin1_swedish_ci
591+
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS with t as (select `test`.`t1`.`a` AS `a`,count(0) AS `count(*)` from `test`.`t1` where `test`.`t1`.`b` >= 'c' group by `test`.`t1`.`a`)select `test`.`t2`.`c` AS `c`,`t`.`a` AS `a`,`t`.`count(*)` AS `count(*)` from (`test`.`t2` join `t`) where `test`.`t2`.`c` = `t`.`a` latin1 latin1_swedish_ci
592592
select * from v2;
593593
c a count(*)
594594
4 4 2
@@ -606,7 +606,7 @@ with t(c) as (select a from t1 where b >= 'c')
606606
select * from t r1 where r1.c=4;
607607
show create view v3;
608608
View Create View character_set_client collation_connection
609-
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS with t(c) as (select `t1`.`a` AS `c` from `t1` where `t1`.`b` >= 'c')select `r1`.`c` AS `c` from `t` `r1` where `r1`.`c` = 4 latin1 latin1_swedish_ci
609+
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS with t(c) as (select `test`.`t1`.`a` AS `c` from `test`.`t1` where `test`.`t1`.`b` >= 'c')select `r1`.`c` AS `c` from `t` `r1` where `r1`.`c` = 4 latin1 latin1_swedish_ci
610610
select * from v3;
611611
c
612612
4
@@ -1349,7 +1349,7 @@ r.r_regionkey in
13491349
select r_regionkey from t where r_name <> "ASIA");
13501350
show create view v;
13511351
View Create View character_set_client collation_connection
1352-
v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `n`.`n_nationkey` AS `n_nationkey`,`n`.`n_name` AS `n_name`,`n`.`n_regionkey` AS `n_regionkey`,`r`.`r_regionkey` AS `r_regionkey`,`r`.`r_name` AS `r_name` from (`nation` `n` join `region` `r`) where `n`.`n_regionkey` = `r`.`r_regionkey` and `r`.`r_regionkey` in (with t as (select `region`.`r_regionkey` AS `r_regionkey`,`region`.`r_name` AS `r_name` from `region` where `region`.`r_regionkey` <= 3)select `t`.`r_regionkey` from `t` where `t`.`r_name` <> 'ASIA') latin1 latin1_swedish_ci
1352+
v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `n`.`n_nationkey` AS `n_nationkey`,`n`.`n_name` AS `n_name`,`n`.`n_regionkey` AS `n_regionkey`,`r`.`r_regionkey` AS `r_regionkey`,`r`.`r_name` AS `r_name` from (`test`.`nation` `n` join `test`.`region` `r`) where `n`.`n_regionkey` = `r`.`r_regionkey` and `r`.`r_regionkey` in (with t as (select `test`.`region`.`r_regionkey` AS `r_regionkey`,`test`.`region`.`r_name` AS `r_name` from `test`.`region` where `test`.`region`.`r_regionkey` <= 3)select `t`.`r_regionkey` from `t` where `t`.`r_name` <> 'ASIA') latin1 latin1_swedish_ci
13531353
select * from v;
13541354
n_nationkey n_name n_regionkey r_regionkey r_name
13551355
0 ALGERIA 0 0 AFRICA
@@ -1690,6 +1690,41 @@ ERROR 3D000: No database selected
16901690
DROP TABLE test.t;
16911691
connection default;
16921692
disconnect con1;
1693+
#
1694+
# MDEV-22781: create view with CTE without default database
1695+
#
1696+
drop database test;
1697+
create database db1;
1698+
create table db1.t1 (a int);
1699+
insert into db1.t1 values (3),(7),(1);
1700+
create view db1.v1 as with t as (select * from db1.t1) select * from t;
1701+
show create view db1.v1;
1702+
View Create View character_set_client collation_connection
1703+
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `db1`.`v1` AS with t as (select `db1`.`t1`.`a` AS `a` from `db1`.`t1`)select `t`.`a` AS `a` from `t` latin1 latin1_swedish_ci
1704+
select * from db1.v1;
1705+
a
1706+
3
1707+
7
1708+
1
1709+
drop view db1.v1;
1710+
prepare stmt from "
1711+
create view db1.v1 as with t as (select * from db1.t1) select * from t;
1712+
";
1713+
execute stmt;
1714+
deallocate prepare stmt;
1715+
show create view db1.v1;
1716+
View Create View character_set_client collation_connection
1717+
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `db1`.`v1` AS with t as (select `db1`.`t1`.`a` AS `a` from `db1`.`t1`)select `t`.`a` AS `a` from `t` latin1 latin1_swedish_ci
1718+
select * from db1.v1;
1719+
a
1720+
3
1721+
7
1722+
1
1723+
drop view db1.v1;
1724+
drop table db1.t1;
1725+
drop database db1;
1726+
create database test;
1727+
use test;
16931728
# End of 10.2 tests
16941729
#
16951730
# MDEV-21673: several references to CTE that uses

mysql-test/main/cte_nonrecursive.test

+29
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,35 @@ DROP TABLE test.t;
12011201
--connection default
12021202
--disconnect con1
12031203

1204+
--echo #
1205+
--echo # MDEV-22781: create view with CTE without default database
1206+
--echo #
1207+
1208+
drop database test;
1209+
create database db1;
1210+
create table db1.t1 (a int);
1211+
insert into db1.t1 values (3),(7),(1);
1212+
1213+
create view db1.v1 as with t as (select * from db1.t1) select * from t;
1214+
show create view db1.v1;
1215+
select * from db1.v1;
1216+
drop view db1.v1;
1217+
1218+
prepare stmt from "
1219+
create view db1.v1 as with t as (select * from db1.t1) select * from t;
1220+
";
1221+
execute stmt;
1222+
deallocate prepare stmt;
1223+
show create view db1.v1;
1224+
select * from db1.v1;
1225+
drop view db1.v1;
1226+
1227+
drop table db1.t1;
1228+
drop database db1;
1229+
1230+
create database test;
1231+
use test;
1232+
12041233
--echo # End of 10.2 tests
12051234

12061235
--echo #
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#
2+
# MDEV-20751: query using many CTEs with grant_tables enabled
3+
#
4+
connection default;
5+
CREATE DATABASE db;
6+
USE db;
7+
CREATE TABLE t1 (a int) ENGINE=MYISAM;
8+
INSERT INTO t1 VALUES (3), (7), (1);
9+
CREATE TABLE t2 (a int) ENGINE=MYISAM;
10+
INSERT INTO t2 VALUES (2), (8), (4);
11+
CREATE USER 'u1'@'localhost';
12+
GRANT USAGE ON db.* TO 'u1'@'localhost';
13+
GRANT SELECT ON db.t1 TO 'u1'@'localhost';
14+
FLUSH PRIVILEGES;
15+
connect u1,'localhost',u1,,;
16+
connection u1;
17+
USE db;
18+
WITH
19+
cte1 AS
20+
(SELECT a FROM t1),
21+
cte2 AS
22+
(SELECT cte1.a FROM t1,cte1 WHERE cte1.a = t1.a),
23+
cte3 AS
24+
(SELECT cte2.a FROM t1,cte1,cte2 WHERE cte1.a = t1.a AND t1.a = cte2.a),
25+
cte4 AS
26+
(SELECT cte2.a FROM t1,cte2 WHERE cte2.a = t1.a)
27+
SELECT * FROM cte4 as r;
28+
a
29+
3
30+
7
31+
1
32+
WITH
33+
cte1 AS
34+
(SELECT a FROM t2),
35+
cte2 AS
36+
(SELECT cte1.a FROM t2,cte1 WHERE cte1.a = t2.a),
37+
cte3 AS
38+
(SELECT cte2.a FROM t2,cte1,cte2 WHERE cte1.a = t2.a AND t2.a = cte2.a),
39+
cte4 AS
40+
(SELECT cte2.a FROM t2,cte2 WHERE cte2.a = t2.a)
41+
SELECT * FROM cte4 as r;
42+
ERROR 42000: SELECT command denied to user 'u1'@'localhost' for table 't2'
43+
disconnect u1;
44+
connection default;
45+
DROP USER 'u1'@'localhost';
46+
DROP DATABASE db;
47+
USE test;
48+
# End of 10.2 tests
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
-- source include/not_embedded.inc
2+
3+
--echo #
4+
--echo # MDEV-20751: query using many CTEs with grant_tables enabled
5+
--echo #
6+
7+
--connection default
8+
9+
CREATE DATABASE db;
10+
USE db;
11+
12+
CREATE TABLE t1 (a int) ENGINE=MYISAM;
13+
INSERT INTO t1 VALUES (3), (7), (1);
14+
CREATE TABLE t2 (a int) ENGINE=MYISAM;
15+
INSERT INTO t2 VALUES (2), (8), (4);
16+
17+
18+
CREATE USER 'u1'@'localhost';
19+
GRANT USAGE ON db.* TO 'u1'@'localhost';
20+
GRANT SELECT ON db.t1 TO 'u1'@'localhost';
21+
FLUSH PRIVILEGES;
22+
23+
--connect (u1,'localhost',u1,,)
24+
--connection u1
25+
USE db;
26+
27+
WITH
28+
cte1 AS
29+
(SELECT a FROM t1),
30+
cte2 AS
31+
(SELECT cte1.a FROM t1,cte1 WHERE cte1.a = t1.a),
32+
cte3 AS
33+
(SELECT cte2.a FROM t1,cte1,cte2 WHERE cte1.a = t1.a AND t1.a = cte2.a),
34+
cte4 AS
35+
(SELECT cte2.a FROM t1,cte2 WHERE cte2.a = t1.a)
36+
SELECT * FROM cte4 as r;
37+
38+
--error ER_TABLEACCESS_DENIED_ERROR
39+
WITH
40+
cte1 AS
41+
(SELECT a FROM t2),
42+
cte2 AS
43+
(SELECT cte1.a FROM t2,cte1 WHERE cte1.a = t2.a),
44+
cte3 AS
45+
(SELECT cte2.a FROM t2,cte1,cte2 WHERE cte1.a = t2.a AND t2.a = cte2.a),
46+
cte4 AS
47+
(SELECT cte2.a FROM t2,cte2 WHERE cte2.a = t2.a)
48+
SELECT * FROM cte4 as r;
49+
50+
--disconnect u1
51+
--connection default
52+
53+
DROP USER 'u1'@'localhost';
54+
DROP DATABASE db;
55+
56+
USE test;
57+
58+
--echo # End of 10.2 tests

0 commit comments

Comments
 (0)