Skip to content

Commit

Permalink
Merge branch '10.2' into 10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
sanja-byelkin committed Dec 23, 2020
2 parents fa1aef3 + 8d8370e commit 2556143
Show file tree
Hide file tree
Showing 115 changed files with 1,936 additions and 1,234 deletions.
4 changes: 4 additions & 0 deletions extra/mariabackup/xtrabackup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5766,6 +5766,10 @@ static bool xtrabackup_prepare_func(char** argv)
ut_ad(inc_dir_tables_hash);
}

msg("open files limit requested %u, set to %u",
(uint) xb_open_files_limit,
xb_set_max_open_files(xb_open_files_limit));

/* Fix DDL for prepare. Process .del,.ren, and .new files.
The order in which files are processed, is important
(see MDEV-18185, MDEV-18201)
Expand Down
4 changes: 3 additions & 1 deletion include/mysql/plugin_ftparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ typedef struct st_mysql_ftparser_boolean_info
the word to MySQL full-text index. When parsing a search query,
this function will add the new word to the list of words to search
for. The boolean_info argument can be NULL for all cases except
when mode is MYSQL_FTPARSER_FULL_BOOLEAN_INFO.
when mode is MYSQL_FTPARSER_FULL_BOOLEAN_INFO. A plugin can replace this
callback to post-process every parsed word before passing it to the original
mysql_add_word function.
ftparser_state: A generic pointer. The plugin can set it to point
to information to be used internally for its own purposes.
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/include/ctype_utf8mb4.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1587,7 +1587,7 @@ drop table t1;
--echo #
--echo # Check strnxfrm() with odd length
--echo #
set max_sort_length=9;
set max_sort_length=65;
select @@max_sort_length;
eval create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci) engine $engine;
insert into t1 values ('a'),('b'),('c');
Expand Down
43 changes: 39 additions & 4 deletions mysql-test/main/cte_nonrecursive.result
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ with t as (select a from t1 where b >= 'c')
select * from t2,t where t2.c=t.a;
show create view v1;
View Create View character_set_client collation_connection
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
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
select * from v1;
c a
4 4
Expand All @@ -588,7 +588,7 @@ with t as (select a, count(*) from t1 where b >= 'c' group by a)
select * from t2,t where t2.c=t.a;
show create view v2;
View Create View character_set_client collation_connection
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
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
select * from v2;
c a count(*)
4 4 2
Expand All @@ -606,7 +606,7 @@ with t(c) as (select a from t1 where b >= 'c')
select * from t r1 where r1.c=4;
show create view v3;
View Create View character_set_client collation_connection
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
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
select * from v3;
c
4
Expand Down Expand Up @@ -1349,7 +1349,7 @@ r.r_regionkey in
select r_regionkey from t where r_name <> "ASIA");
show create view v;
View Create View character_set_client collation_connection
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
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
select * from v;
n_nationkey n_name n_regionkey r_regionkey r_name
0 ALGERIA 0 0 AFRICA
Expand Down Expand Up @@ -1690,6 +1690,41 @@ ERROR 3D000: No database selected
DROP TABLE test.t;
connection default;
disconnect con1;
#
# MDEV-22781: create view with CTE without default database
#
drop database test;
create database db1;
create table db1.t1 (a int);
insert into db1.t1 values (3),(7),(1);
create view db1.v1 as with t as (select * from db1.t1) select * from t;
show create view db1.v1;
View Create View character_set_client collation_connection
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
select * from db1.v1;
a
3
7
1
drop view db1.v1;
prepare stmt from "
create view db1.v1 as with t as (select * from db1.t1) select * from t;
";
execute stmt;
deallocate prepare stmt;
show create view db1.v1;
View Create View character_set_client collation_connection
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
select * from db1.v1;
a
3
7
1
drop view db1.v1;
drop table db1.t1;
drop database db1;
create database test;
use test;
# End of 10.2 tests
#
# MDEV-21673: several references to CTE that uses
Expand Down
29 changes: 29 additions & 0 deletions mysql-test/main/cte_nonrecursive.test
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,35 @@ DROP TABLE test.t;
--connection default
--disconnect con1

--echo #
--echo # MDEV-22781: create view with CTE without default database
--echo #

drop database test;
create database db1;
create table db1.t1 (a int);
insert into db1.t1 values (3),(7),(1);

create view db1.v1 as with t as (select * from db1.t1) select * from t;
show create view db1.v1;
select * from db1.v1;
drop view db1.v1;

prepare stmt from "
create view db1.v1 as with t as (select * from db1.t1) select * from t;
";
execute stmt;
deallocate prepare stmt;
show create view db1.v1;
select * from db1.v1;
drop view db1.v1;

drop table db1.t1;
drop database db1;

create database test;
use test;

--echo # End of 10.2 tests

--echo #
Expand Down
48 changes: 48 additions & 0 deletions mysql-test/main/cte_nonrecursive_not_embedded.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#
# MDEV-20751: query using many CTEs with grant_tables enabled
#
connection default;
CREATE DATABASE db;
USE db;
CREATE TABLE t1 (a int) ENGINE=MYISAM;
INSERT INTO t1 VALUES (3), (7), (1);
CREATE TABLE t2 (a int) ENGINE=MYISAM;
INSERT INTO t2 VALUES (2), (8), (4);
CREATE USER 'u1'@'localhost';
GRANT USAGE ON db.* TO 'u1'@'localhost';
GRANT SELECT ON db.t1 TO 'u1'@'localhost';
FLUSH PRIVILEGES;
connect u1,'localhost',u1,,;
connection u1;
USE db;
WITH
cte1 AS
(SELECT a FROM t1),
cte2 AS
(SELECT cte1.a FROM t1,cte1 WHERE cte1.a = t1.a),
cte3 AS
(SELECT cte2.a FROM t1,cte1,cte2 WHERE cte1.a = t1.a AND t1.a = cte2.a),
cte4 AS
(SELECT cte2.a FROM t1,cte2 WHERE cte2.a = t1.a)
SELECT * FROM cte4 as r;
a
3
7
1
WITH
cte1 AS
(SELECT a FROM t2),
cte2 AS
(SELECT cte1.a FROM t2,cte1 WHERE cte1.a = t2.a),
cte3 AS
(SELECT cte2.a FROM t2,cte1,cte2 WHERE cte1.a = t2.a AND t2.a = cte2.a),
cte4 AS
(SELECT cte2.a FROM t2,cte2 WHERE cte2.a = t2.a)
SELECT * FROM cte4 as r;
ERROR 42000: SELECT command denied to user 'u1'@'localhost' for table 't2'
disconnect u1;
connection default;
DROP USER 'u1'@'localhost';
DROP DATABASE db;
USE test;
# End of 10.2 tests
58 changes: 58 additions & 0 deletions mysql-test/main/cte_nonrecursive_not_embedded.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
-- source include/not_embedded.inc

--echo #
--echo # MDEV-20751: query using many CTEs with grant_tables enabled
--echo #

--connection default

CREATE DATABASE db;
USE db;

CREATE TABLE t1 (a int) ENGINE=MYISAM;
INSERT INTO t1 VALUES (3), (7), (1);
CREATE TABLE t2 (a int) ENGINE=MYISAM;
INSERT INTO t2 VALUES (2), (8), (4);


CREATE USER 'u1'@'localhost';
GRANT USAGE ON db.* TO 'u1'@'localhost';
GRANT SELECT ON db.t1 TO 'u1'@'localhost';
FLUSH PRIVILEGES;

--connect (u1,'localhost',u1,,)
--connection u1
USE db;

WITH
cte1 AS
(SELECT a FROM t1),
cte2 AS
(SELECT cte1.a FROM t1,cte1 WHERE cte1.a = t1.a),
cte3 AS
(SELECT cte2.a FROM t1,cte1,cte2 WHERE cte1.a = t1.a AND t1.a = cte2.a),
cte4 AS
(SELECT cte2.a FROM t1,cte2 WHERE cte2.a = t1.a)
SELECT * FROM cte4 as r;

--error ER_TABLEACCESS_DENIED_ERROR
WITH
cte1 AS
(SELECT a FROM t2),
cte2 AS
(SELECT cte1.a FROM t2,cte1 WHERE cte1.a = t2.a),
cte3 AS
(SELECT cte2.a FROM t2,cte1,cte2 WHERE cte1.a = t2.a AND t2.a = cte2.a),
cte4 AS
(SELECT cte2.a FROM t2,cte2 WHERE cte2.a = t2.a)
SELECT * FROM cte4 as r;

--disconnect u1
--connection default

DROP USER 'u1'@'localhost';
DROP DATABASE db;

USE test;

--echo # End of 10.2 tests
Loading

0 comments on commit 2556143

Please sign in to comment.