diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-10-29 15:08:44 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-10-29 15:08:44 +0100 |
commit | 0fdb3bcfdbfa5d7cad28adc1c0f7c0958cdab2e0 (patch) | |
tree | 7d6a1d36b975e2b1bb8d9ffd3b7511ec0694349e /mysql-test | |
parent | 7dc48ae327ad27205dffe0cec16b445d01529f84 (diff) | |
parent | fef416699009b78366d9eec937c01822b531f518 (diff) | |
download | mariadb-git-0fdb3bcfdbfa5d7cad28adc1c0f7c0958cdab2e0.tar.gz |
10.0-base merge (roles)
Diffstat (limited to 'mysql-test')
207 files changed, 5955 insertions, 394 deletions
diff --git a/mysql-test/include/mtr_check.sql b/mysql-test/include/mtr_check.sql index 9267374e15d..46c2d59aa59 100644 --- a/mysql-test/include/mtr_check.sql +++ b/mysql-test/include/mtr_check.sql @@ -69,6 +69,7 @@ BEGIN mysql.host, mysql.proc, mysql.procs_priv, + mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index a7a53166563..3b8cb96eacb 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -182,6 +182,7 @@ my $DEFAULT_SUITES= join(',', map { "$_-" } qw( percona perfschema plugins + roles rpl sphinx sys_vars diff --git a/mysql-test/r/1st.result b/mysql-test/r/1st.result index cb82cb5fe7d..f9e4b37aa94 100644 --- a/mysql-test/r/1st.result +++ b/mysql-test/r/1st.result @@ -26,6 +26,7 @@ plugin proc procs_priv proxies_priv +roles_mapping servers slow_log table_stats diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result index 84a1e9dbab2..a4e6f374916 100644 --- a/mysql-test/r/connect.result +++ b/mysql-test/r/connect.result @@ -20,6 +20,7 @@ plugin proc procs_priv proxies_priv +roles_mapping servers slow_log table_stats @@ -59,6 +60,7 @@ plugin proc procs_priv proxies_priv +roles_mapping servers slow_log table_stats @@ -106,6 +108,7 @@ plugin proc procs_priv proxies_priv +roles_mapping servers slow_log table_stats diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result index fe90bd3288b..e3599218aac 100644 --- a/mysql-test/r/events_bugs.result +++ b/mysql-test/r/events_bugs.result @@ -569,7 +569,7 @@ USE test; SHOW GRANTS FOR CURRENT_USER; Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION SET GLOBAL event_scheduler = ON; CREATE TABLE events_test.event_log (id int KEY AUTO_INCREMENT, ev_nm char(40), ev_cnt int, ev_tm timestamp) diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index c50f6e05621..c711f27264d 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -56,6 +56,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA' @@ -128,6 +129,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 @@ -176,6 +178,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 MAX_UPDATES_PER_HOUR 20 MAX_CONNECTIONS_PER_HOUR 30 @@ -750,28 +753,28 @@ show grants for root@localhost; Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION GRANT SELECT ON `ÂÄ`.* TO 'root'@'localhost' -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION flush privileges; show grants for root@localhost; Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION GRANT SELECT ON `ÂÄ`.* TO 'root'@'localhost' -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION drop database ÂÄ; revoke all privileges on ÂÄ.* from root@localhost; show grants for root@localhost; Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION set names latin1; create user mysqltest_7@; set password for mysqltest_7@ = password('systpass'); show grants for mysqltest_7@; -Grants for mysqltest_7@ -GRANT USAGE ON *.* TO 'mysqltest_7'@'' IDENTIFIED BY PASSWORD '*2FB071A056F9BB745219D9C876814231DAF46517' +Grants for mysqltest_7@% +GRANT USAGE ON *.* TO 'mysqltest_7'@'%' IDENTIFIED BY PASSWORD '*2FB071A056F9BB745219D9C876814231DAF46517' drop user mysqltest_7@; show grants for mysqltest_7@; -ERROR 42000: There is no such grant defined for user 'mysqltest_7' on host '' +ERROR 42000: There is no such grant defined for user 'mysqltest_7' on host '%' create database mysqltest; use mysqltest; create table t1(f1 int); @@ -807,30 +810,28 @@ create table t2 as select * from mysql.user where user=''; delete from mysql.user where user=''; flush privileges; create user mysqltest_8@''; -create user mysqltest_8; create user mysqltest_8@host8; create user mysqltest_8@''; -ERROR HY000: Operation CREATE USER failed for 'mysqltest_8'@'' +ERROR HY000: Operation CREATE USER failed for 'mysqltest_8'@'%' create user mysqltest_8; ERROR HY000: Operation CREATE USER failed for 'mysqltest_8'@'%' create user mysqltest_8@host8; ERROR HY000: Operation CREATE USER failed for 'mysqltest_8'@'host8' select user, QUOTE(host) from mysql.user where user="mysqltest_8"; user QUOTE(host) -mysqltest_8 '' mysqltest_8 '%' mysqltest_8 'host8' Schema privileges grant select on mysqltest.* to mysqltest_8@''; show grants for mysqltest_8@''; -Grants for mysqltest_8@ -GRANT USAGE ON *.* TO 'mysqltest_8'@'' -GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@'' +Grants for mysqltest_8@% +GRANT USAGE ON *.* TO 'mysqltest_8'@'%' +GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@'%' grant select on mysqltest.* to mysqltest_8@; show grants for mysqltest_8@; -Grants for mysqltest_8@ -GRANT USAGE ON *.* TO 'mysqltest_8'@'' -GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@'' +Grants for mysqltest_8@% +GRANT USAGE ON *.* TO 'mysqltest_8'@'%' +GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@'%' grant select on mysqltest.* to mysqltest_8; show grants for mysqltest_8; Grants for mysqltest_8@% @@ -840,14 +841,12 @@ select * from information_schema.schema_privileges where grantee like "'mysqltest_8'%"; GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE 'mysqltest_8'@'%' def mysqltest SELECT NO -'mysqltest_8'@'' def mysqltest SELECT NO select * from t1; a revoke select on mysqltest.* from mysqltest_8@''; -revoke select on mysqltest.* from mysqltest_8; show grants for mysqltest_8@''; -Grants for mysqltest_8@ -GRANT USAGE ON *.* TO 'mysqltest_8'@'' +Grants for mysqltest_8@% +GRANT USAGE ON *.* TO 'mysqltest_8'@'%' show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO 'mysqltest_8'@'%' @@ -856,35 +855,35 @@ where grantee like "'mysqltest_8'%"; GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE flush privileges; show grants for mysqltest_8@''; -Grants for mysqltest_8@ -GRANT USAGE ON *.* TO 'mysqltest_8'@'' +Grants for mysqltest_8@% +GRANT USAGE ON *.* TO 'mysqltest_8'@'%' show grants for mysqltest_8@; -Grants for mysqltest_8@ -GRANT USAGE ON *.* TO 'mysqltest_8'@'' +Grants for mysqltest_8@% +GRANT USAGE ON *.* TO 'mysqltest_8'@'%' grant select on mysqltest.* to mysqltest_8@''; flush privileges; show grants for mysqltest_8@; -Grants for mysqltest_8@ -GRANT USAGE ON *.* TO 'mysqltest_8'@'' -GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@'' +Grants for mysqltest_8@% +GRANT USAGE ON *.* TO 'mysqltest_8'@'%' +GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@'%' revoke select on mysqltest.* from mysqltest_8@''; flush privileges; Column privileges grant update (a) on t1 to mysqltest_8@''; grant update (a) on t1 to mysqltest_8; show grants for mysqltest_8@''; -Grants for mysqltest_8@ -GRANT USAGE ON *.* TO 'mysqltest_8'@'' -GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'' +Grants for mysqltest_8@% +GRANT USAGE ON *.* TO 'mysqltest_8'@'%' +GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%' show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO 'mysqltest_8'@'%' GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%' flush privileges; show grants for mysqltest_8@''; -Grants for mysqltest_8@ -GRANT USAGE ON *.* TO 'mysqltest_8'@'' -GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'' +Grants for mysqltest_8@% +GRANT USAGE ON *.* TO 'mysqltest_8'@'%' +GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%' show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO 'mysqltest_8'@'%' @@ -892,14 +891,12 @@ GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%' select * from information_schema.column_privileges; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE 'mysqltest_8'@'%' def test t1 a UPDATE NO -'mysqltest_8'@'' def test t1 a UPDATE NO select * from t1; a revoke update (a) on t1 from mysqltest_8@''; -revoke update (a) on t1 from mysqltest_8; show grants for mysqltest_8@''; -Grants for mysqltest_8@ -GRANT USAGE ON *.* TO 'mysqltest_8'@'' +Grants for mysqltest_8@% +GRANT USAGE ON *.* TO 'mysqltest_8'@'%' show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO 'mysqltest_8'@'%' @@ -907,8 +904,8 @@ select * from information_schema.column_privileges; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE flush privileges; show grants for mysqltest_8@''; -Grants for mysqltest_8@ -GRANT USAGE ON *.* TO 'mysqltest_8'@'' +Grants for mysqltest_8@% +GRANT USAGE ON *.* TO 'mysqltest_8'@'%' show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO 'mysqltest_8'@'%' @@ -916,18 +913,18 @@ Table privileges grant update on t1 to mysqltest_8@''; grant update on t1 to mysqltest_8; show grants for mysqltest_8@''; -Grants for mysqltest_8@ -GRANT USAGE ON *.* TO 'mysqltest_8'@'' -GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'' +Grants for mysqltest_8@% +GRANT USAGE ON *.* TO 'mysqltest_8'@'%' +GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'%' show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO 'mysqltest_8'@'%' GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'%' flush privileges; show grants for mysqltest_8@''; -Grants for mysqltest_8@ -GRANT USAGE ON *.* TO 'mysqltest_8'@'' -GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'' +Grants for mysqltest_8@% +GRANT USAGE ON *.* TO 'mysqltest_8'@'%' +GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'%' show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO 'mysqltest_8'@'%' @@ -935,14 +932,12 @@ GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'%' select * from information_schema.table_privileges; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE 'mysqltest_8'@'%' def test t1 UPDATE NO -'mysqltest_8'@'' def test t1 UPDATE NO select * from t1; a revoke update on t1 from mysqltest_8@''; -revoke update on t1 from mysqltest_8; show grants for mysqltest_8@''; -Grants for mysqltest_8@ -GRANT USAGE ON *.* TO 'mysqltest_8'@'' +Grants for mysqltest_8@% +GRANT USAGE ON *.* TO 'mysqltest_8'@'%' show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO 'mysqltest_8'@'%' @@ -950,8 +945,8 @@ select * from information_schema.table_privileges; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE flush privileges; show grants for mysqltest_8@''; -Grants for mysqltest_8@ -GRANT USAGE ON *.* TO 'mysqltest_8'@'' +Grants for mysqltest_8@% +GRANT USAGE ON *.* TO 'mysqltest_8'@'%' show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO 'mysqltest_8'@'%' @@ -962,45 +957,36 @@ grant update on t1 to mysqltest_8@''; grant update (a) on t1 to mysqltest_8@''; grant all privileges on mysqltest.* to mysqltest_8; show grants for mysqltest_8@''; -Grants for mysqltest_8@ -GRANT USAGE ON *.* TO 'mysqltest_8'@'' -GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'' -GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'' +Grants for mysqltest_8@% +GRANT USAGE ON *.* TO 'mysqltest_8'@'%' +GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%' +GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%' show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO 'mysqltest_8'@'%' GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%' +GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%' select * from information_schema.user_privileges where grantee like "'mysqltest_8'%"; GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE 'mysqltest_8'@'host8' def USAGE NO 'mysqltest_8'@'%' def USAGE NO -'mysqltest_8'@'' def USAGE NO select * from t1; a flush privileges; show grants for mysqltest_8@''; -Grants for mysqltest_8@ -GRANT USAGE ON *.* TO 'mysqltest_8'@'' -GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'' -GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'' -show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO 'mysqltest_8'@'%' GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%' -drop user mysqltest_8@''; -show grants for mysqltest_8@''; -ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host '' +GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%' show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO 'mysqltest_8'@'%' GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%' -select * from information_schema.user_privileges -where grantee like "'mysqltest_8'%"; -GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE -'mysqltest_8'@'host8' def USAGE NO -'mysqltest_8'@'%' def USAGE NO -drop user mysqltest_8; +GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%' +drop user mysqltest_8@''; +show grants for mysqltest_8@''; +ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host '%' connect(localhost,mysqltest_8,,test,MASTER_PORT,MASTER_SOCKET); ERROR 28000: Access denied for user 'mysqltest_8'@'localhost' (using password: NO) show grants for mysqltest_8; @@ -1699,7 +1685,6 @@ use test; FLUSH PRIVILEGES without procs_priv table. RENAME TABLE mysql.procs_priv TO mysql.procs_gone; FLUSH PRIVILEGES; -ERROR 42S02: Table 'mysql.procs_priv' doesn't exist Assigning privileges without procs_priv table. CREATE DATABASE mysqltest1; CREATE PROCEDURE mysqltest1.test() SQL SECURITY DEFINER diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result index 9d92abbda07..3df9a5480d3 100644 --- a/mysql-test/r/grant2.result +++ b/mysql-test/r/grant2.result @@ -36,7 +36,7 @@ select @@sql_mode; @@sql_mode NO_AUTO_CREATE_USER grant select on `my\_1`.* to mysqltest_4@localhost with grant option; -ERROR 42000: Can't find any matching row in the user table +ERROR 28000: Can't find any matching row in the user table grant select on `my\_1`.* to mysqltest_4@localhost identified by 'mypass' with grant option; show grants for mysqltest_1@localhost; @@ -335,7 +335,7 @@ delete from mysql.user where user like 'mysqltest\_1'; flush privileges; drop database mysqltest_1; set password = password("changed"); -ERROR 42000: Can't find any matching row in the user table +ERROR 42000: You are using MariaDB as an anonymous user and anonymous users are not allowed to change passwords lock table mysql.user write; flush privileges; grant all on *.* to 'mysqltest_1'@'localhost'; diff --git a/mysql-test/r/grant_cache_no_prot.result b/mysql-test/r/grant_cache_no_prot.result index e95a858fd9a..777eb10cda6 100644 --- a/mysql-test/r/grant_cache_no_prot.result +++ b/mysql-test/r/grant_cache_no_prot.result @@ -7,11 +7,11 @@ flush status; show grants for current_user; Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION show grants; Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION create database if not exists mysqltest; create table mysqltest.t1 (a int,b int,c int); create table mysqltest.t2 (a int,b int,c int); diff --git a/mysql-test/r/grant_cache_ps_prot.result b/mysql-test/r/grant_cache_ps_prot.result index f9786298a81..b504dc4be35 100644 --- a/mysql-test/r/grant_cache_ps_prot.result +++ b/mysql-test/r/grant_cache_ps_prot.result @@ -7,11 +7,11 @@ flush status; show grants for current_user; Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION show grants; Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION create database if not exists mysqltest; create table mysqltest.t1 (a int,b int,c int); create table mysqltest.t2 (a int,b int,c int); diff --git a/mysql-test/r/information_schema-big.result b/mysql-test/r/information_schema-big.result index c0016a8e5c3..55ed95f6452 100644 --- a/mysql-test/r/information_schema-big.result +++ b/mysql-test/r/information_schema-big.result @@ -19,12 +19,15 @@ c2.column_name LIKE '%SCHEMA%' ) AND t.table_name NOT LIKE 'innodb%'; table_name column_name +ALL_PLUGINS PLUGIN_NAME +APPLICABLE_ROLES GRANTEE CHARACTER_SETS CHARACTER_SET_NAME CLIENT_STATISTICS CLIENT COLLATIONS COLLATION_NAME COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME COLUMNS TABLE_SCHEMA COLUMN_PRIVILEGES TABLE_SCHEMA +ENABLED_ROLES ROLE_NAME ENGINES ENGINE EVENTS EVENT_SCHEMA FILES TABLE_SCHEMA @@ -36,7 +39,6 @@ KEY_COLUMN_USAGE CONSTRAINT_SCHEMA PARAMETERS SPECIFIC_SCHEMA PARTITIONS TABLE_SCHEMA PLUGINS PLUGIN_NAME -ALL_PLUGINS PLUGIN_NAME PROCESSLIST ID PROFILING QUERY_ID REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA @@ -72,12 +74,15 @@ c2.column_name LIKE '%SCHEMA%' ) AND t.table_name NOT LIKE 'innodb%'; table_name column_name +ALL_PLUGINS PLUGIN_NAME +APPLICABLE_ROLES GRANTEE CHARACTER_SETS CHARACTER_SET_NAME CLIENT_STATISTICS CLIENT COLLATIONS COLLATION_NAME COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME COLUMNS TABLE_SCHEMA COLUMN_PRIVILEGES TABLE_SCHEMA +ENABLED_ROLES ROLE_NAME ENGINES ENGINE EVENTS EVENT_SCHEMA FILES TABLE_SCHEMA @@ -89,7 +94,6 @@ KEY_COLUMN_USAGE CONSTRAINT_SCHEMA PARAMETERS SPECIFIC_SCHEMA PARTITIONS TABLE_SCHEMA PLUGINS PLUGIN_NAME -ALL_PLUGINS PLUGIN_NAME PROCESSLIST ID PROFILING QUERY_ID REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index bf25b1c28ee..39543985005 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -47,12 +47,14 @@ table_name not like 'xtradb_%'; select * from v1; c ALL_PLUGINS +APPLICABLE_ROLES CHARACTER_SETS CLIENT_STATISTICS COLLATIONS COLLATION_CHARACTER_SET_APPLICABILITY COLUMNS COLUMN_PRIVILEGES +ENABLED_ROLES ENGINES EVENTS FILES @@ -99,6 +101,7 @@ plugin proc procs_priv proxies_priv +roles_mapping servers slow_log t1 @@ -650,8 +653,8 @@ select TABLE_NAME,TABLE_TYPE,ENGINE from information_schema.tables where table_schema='information_schema' limit 2; TABLE_NAME TABLE_TYPE ENGINE -CHARACTER_SETS SYSTEM VIEW MEMORY -CLIENT_STATISTICS SYSTEM VIEW MEMORY +ALL_PLUGINS SYSTEM VIEW Aria +APPLICABLE_ROLES SYSTEM VIEW MEMORY show tables from information_schema like "T%"; Tables_in_information_schema (T%) TABLES @@ -706,6 +709,7 @@ max_questions select,insert,update,references max_connections select,insert,update,references max_user_connections select,insert,update,references authentication_string select,insert,update,references +is_role select,insert,update,references use test; create function sub1(i int) returns int return i+1; @@ -796,6 +800,7 @@ select table_schema,table_name, column_name from information_schema.columns where data_type = 'longtext'; table_schema table_name column_name +information_schema ALL_PLUGINS PLUGIN_DESCRIPTION information_schema COLUMNS COLUMN_DEFAULT information_schema COLUMNS COLUMN_TYPE information_schema EVENTS EVENT_DEFINITION @@ -804,7 +809,6 @@ information_schema PARTITIONS PARTITION_EXPRESSION information_schema PARTITIONS SUBPARTITION_EXPRESSION information_schema PARTITIONS PARTITION_DESCRIPTION information_schema PLUGINS PLUGIN_DESCRIPTION -information_schema ALL_PLUGINS PLUGIN_DESCRIPTION information_schema PROCESSLIST INFO information_schema ROUTINES DTD_IDENTIFIER information_schema ROUTINES ROUTINE_DEFINITION @@ -1183,7 +1187,7 @@ group by column_type order by num; column_type group_concat(table_schema, '.', table_name) num varchar(27) information_schema.COLUMNS 1 varchar(7) information_schema.ROUTINES,information_schema.VIEWS 2 -varchar(20) information_schema.FILES,information_schema.FILES,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.ALL_PLUGINS,information_schema.ALL_PLUGINS,information_schema.ALL_PLUGINS,information_schema.PROFILING 9 +varchar(20) information_schema.ALL_PLUGINS,information_schema.ALL_PLUGINS,information_schema.ALL_PLUGINS,information_schema.FILES,information_schema.FILES,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.PROFILING 9 create table t1(f1 char(1) not null, f2 char(9) not null) default character set utf8; select CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH from diff --git a/mysql-test/r/information_schema_all_engines.result b/mysql-test/r/information_schema_all_engines.result index 3e95d9892cb..ec9027fa32f 100644 --- a/mysql-test/r/information_schema_all_engines.result +++ b/mysql-test/r/information_schema_all_engines.result @@ -2,12 +2,14 @@ use INFORMATION_SCHEMA; show tables; Tables_in_information_schema ALL_PLUGINS +APPLICABLE_ROLES CHARACTER_SETS CLIENT_STATISTICS COLLATIONS COLLATION_CHARACTER_SET_APPLICABILITY COLUMNS COLUMN_PRIVILEGES +ENABLED_ROLES ENGINES EVENTS FILES @@ -76,12 +78,14 @@ c2.column_name LIKE '%SCHEMA%' ) order by t.table_name; table_name column_name ALL_PLUGINS PLUGIN_NAME +APPLICABLE_ROLES GRANTEE CHARACTER_SETS CHARACTER_SET_NAME CLIENT_STATISTICS CLIENT COLLATIONS COLLATION_NAME COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME COLUMNS TABLE_SCHEMA COLUMN_PRIVILEGES TABLE_SCHEMA +ENABLED_ROLES ROLE_NAME ENGINES ENGINE EVENTS EVENT_SCHEMA FILES TABLE_SCHEMA @@ -150,12 +154,14 @@ c2.column_name LIKE '%SCHEMA%' ) order by t.table_name; table_name column_name ALL_PLUGINS PLUGIN_NAME +APPLICABLE_ROLES GRANTEE CHARACTER_SETS CHARACTER_SET_NAME CLIENT_STATISTICS CLIENT COLLATIONS COLLATION_NAME COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME COLUMNS TABLE_SCHEMA COLUMN_PRIVILEGES TABLE_SCHEMA +ENABLED_ROLES ROLE_NAME ENGINES ENGINE EVENTS EVENT_SCHEMA FILES TABLE_SCHEMA @@ -230,6 +236,7 @@ group by c2.column_type order by num limit 1) group by t.table_name order by num1, t.table_name; table_name group_concat(t.table_schema, '.', t.table_name) num1 ALL_PLUGINS information_schema.ALL_PLUGINS 1 +APPLICABLE_ROLES information_schema.APPLICABLE_ROLES 1 CHARACTER_SETS information_schema.CHARACTER_SETS 1 CLIENT_STATISTICS information_schema.CLIENT_STATISTICS 1 COLLATIONS information_schema.COLLATIONS 1 @@ -293,12 +300,14 @@ VIEWS information_schema.VIEWS 1 Database: information_schema | Tables | | ALL_PLUGINS | +| APPLICABLE_ROLES | | CHARACTER_SETS | | CLIENT_STATISTICS | | COLLATIONS | | COLLATION_CHARACTER_SET_APPLICABILITY | | COLUMNS | | COLUMN_PRIVILEGES | +| ENABLED_ROLES | | ENGINES | | EVENTS | | FILES | @@ -357,12 +366,14 @@ Database: information_schema Database: INFORMATION_SCHEMA | Tables | | ALL_PLUGINS | +| APPLICABLE_ROLES | | CHARACTER_SETS | | CLIENT_STATISTICS | | COLLATIONS | | COLLATION_CHARACTER_SET_APPLICABILITY | | COLUMNS | | COLUMN_PRIVILEGES | +| ENABLED_ROLES | | ENGINES | | EVENTS | | FILES | @@ -423,5 +434,5 @@ Wildcard: inf_rmation_schema | information_schema | SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA; table_schema count(*) -information_schema 59 -mysql 27 +information_schema 61 +mysql 28 diff --git a/mysql-test/r/join_cache.result b/mysql-test/r/join_cache.result index 618ce7e540b..476f3e92caa 100644 --- a/mysql-test/r/join_cache.result +++ b/mysql-test/r/join_cache.result @@ -5058,7 +5058,7 @@ EXPLAIN SELECT * FROM t1,t2 WHERE t1.a < 3 and t2.a IS NULL; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using index -1 SIMPLE t2 hash_range idx #hash#idx:idx 5:5 const 4 Using index condition; Rowid-ordered scan; Using join buffer (flat, BNLH join) +1 SIMPLE t2 hash_range idx #hash#idx:idx 5:5 const 4 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNLH join) SELECT * FROM t1,t2 WHERE t1.a < 3 and t2.a IS NULL; a a b 1 NULL 10 @@ -5637,4 +5637,51 @@ c set join_buffer_size=default; set optimizer_switch=@tmp_optimizer_switch; DROP table t1,t2,t3; +# +# MDEV-5123 Remove duplicated conditions pushed both to join_tab->select_cond and join_tab->cache_select->cond for blocked joins. +# +set join_cache_level=default; +set expensive_subquery_limit=0; +create table t1 (c1 int); +create table t2 (c2 int); +create table t3 (c3 int); +insert into t1 values (1), (2); +insert into t2 values (1), (2); +insert into t3 values (2); +explain +select count(*) from t1 straight_join t2 +where c1 = c2-0 and c2 <= (select max(c3) from t3 where c3 = 2 and @counter:=@counter+1); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +2 UNCACHEABLE SUBQUERY t3 system NULL NULL NULL NULL 1 +set @counter=0; +select count(*) from t1 straight_join t2 +where c1 = c2-0 and c2 <= (select max(c3) from t3 where c3 = 2 and @counter:=@counter+1); +count(*) +2 +select @counter; +@counter +2 +explain +select count(*) from t1 straight_join t2 +where c1 = c2-0 and +c2 <= (select max(c3) from t3 where c3 = 2 and @counter:=@counter+1) and +c2 / 2 = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +2 UNCACHEABLE SUBQUERY t3 system NULL NULL NULL NULL 1 +set @counter=0; +select count(*) from t1 straight_join t2 +where c1 = c2-0 and +c2 <= (select max(c3) from t3 where c3 = 2 and @counter:=@counter+1) and +c2 / 2 = 1; +count(*) +1 +select @counter; +@counter +2 +drop table t1,t2,t3; +set expensive_subquery_limit=default; set @@optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/r/limit_rows_examined.result b/mysql-test/r/limit_rows_examined.result index 5dbe01eef4f..130d17ae270 100644 --- a/mysql-test/r/limit_rows_examined.result +++ b/mysql-test/r/limit_rows_examined.result @@ -747,27 +747,27 @@ ERROR HY000: Sort aborted: SHOW STATUS LIKE 'Handler_read%'; Variable_name Value Handler_read_first 0 -Handler_read_key 4 +Handler_read_key 5 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 -Handler_read_rnd_next 52 +Handler_read_rnd_next 46 SHOW STATUS LIKE 'Handler_tmp%'; Variable_name Value Handler_tmp_update 0 -Handler_tmp_write 66 +Handler_tmp_write 70 FLUSH STATUS; SELECT a AS field1, alias2.d AS field2, alias2.f AS field3, alias2.e AS field4, b AS field5 FROM t1, t2 AS alias2, t2 AS alias3 WHERE alias3.c IN ( SELECT 1 UNION SELECT 6 ) GROUP BY field1, field2, field3, field4, field5 -LIMIT ROWS EXAMINED 250; +LIMIT ROWS EXAMINED 124; field1 field2 field3 field4 field5 00:21:38 06:07:10 a 2007-06-08 04:35:26 2007-05-28 00:00:00 Warnings: -Warning 1931 Query execution was interrupted. The query examined at least 251 rows, which exceeds LIMIT ROWS EXAMINED (250). The query result may be incomplete. +Warning 1931 Query execution was interrupted. The query examined at least 125 rows, which exceeds LIMIT ROWS EXAMINED (124). The query result may be incomplete. SHOW STATUS LIKE 'Handler_read%'; Variable_name Value Handler_read_first 0 @@ -777,11 +777,11 @@ Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 2 Handler_read_rnd_deleted 1 -Handler_read_rnd_next 110 +Handler_read_rnd_next 47 SHOW STATUS LIKE 'Handler_tmp%'; Variable_name Value Handler_tmp_update 0 -Handler_tmp_write 133 +Handler_tmp_write 70 drop table t1, t2; MDEV-161 LIMIT_ROWS EXAMINED: query with the limit and NOT EXISTS, without GROUP BY or aggregate, diff --git a/mysql-test/r/log_tables_upgrade.result b/mysql-test/r/log_tables_upgrade.result index 5a53ca03736..6f7bd64eba3 100644 --- a/mysql-test/r/log_tables_upgrade.result +++ b/mysql-test/r/log_tables_upgrade.result @@ -38,6 +38,7 @@ mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK mysql.renamed_general_log OK +mysql.roles_mapping OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result index 74832162afb..06efaf65f5e 100644 --- a/mysql-test/r/mysql_upgrade.result +++ b/mysql-test/r/mysql_upgrade.result @@ -25,6 +25,7 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK +mysql.roles_mapping OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK @@ -67,6 +68,7 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK +mysql.roles_mapping OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK @@ -109,6 +111,7 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK +mysql.roles_mapping OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK @@ -153,6 +156,7 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK +mysql.roles_mapping OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK @@ -201,6 +205,7 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK +mysql.roles_mapping OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK @@ -252,6 +257,7 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK +mysql.roles_mapping OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK @@ -306,6 +312,7 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK +mysql.roles_mapping OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK diff --git a/mysql-test/r/mysql_upgrade_ssl.result b/mysql-test/r/mysql_upgrade_ssl.result index d0609deb552..87b7d51e8b7 100644 --- a/mysql-test/r/mysql_upgrade_ssl.result +++ b/mysql-test/r/mysql_upgrade_ssl.result @@ -27,6 +27,7 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK +mysql.roles_mapping OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index ce9bf367945..81ed26ce96b 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -21,6 +21,7 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK +mysql.roles_mapping OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK @@ -54,6 +55,7 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK +mysql.roles_mapping OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK @@ -81,6 +83,7 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK +mysql.roles_mapping OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK @@ -112,6 +115,7 @@ mysql.plugin Table is already up to date mysql.proc Table is already up to date mysql.procs_priv Table is already up to date mysql.proxies_priv Table is already up to date +mysql.roles_mapping Table is already up to date mysql.servers Table is already up to date mysql.table_stats Table is already up to date mysql.tables_priv Table is already up to date diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index 08531847c66..0e4808aff4c 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -1185,7 +1185,7 @@ performance-schema-max-rwlock-instances 1724 performance-schema-max-socket-classes 10 performance-schema-max-socket-instances 179 performance-schema-max-stage-classes 150 -performance-schema-max-statement-classes 175 +performance-schema-max-statement-classes 179 performance-schema-max-table-handles 445 performance-schema-max-table-instances 445 performance-schema-max-thread-classes 50 diff --git a/mysql-test/r/plugin_auth.result b/mysql-test/r/plugin_auth.result index 356ac76962a..ac5eaa4460b 100644 --- a/mysql-test/r/plugin_auth.result +++ b/mysql-test/r/plugin_auth.result @@ -36,8 +36,6 @@ USER() CURRENT_USER() plug@localhost plug_dest@% ## test SET PASSWORD SET PASSWORD = PASSWORD('plug_dest'); -Warnings: -Note 1699 SET PASSWORD has no significance for users authenticating via plugins ## test bad credentials ERROR 28000: Access denied for user 'plug'@'localhost' (using password: YES) ## test bad default plugin : should get CR_AUTH_PLUGIN_CANNOT_LOAD @@ -116,7 +114,7 @@ ERROR 42000: There is no such grant defined for user 'grant_plug' on host '%' in grant_plug_dest_con ## testing what an ordinary user can grant this should fail : no rights to grant all -GRANT PROXY ON ''@'' TO grant_plug; +GRANT PROXY ON ''@'%%' TO grant_plug; ERROR 28000: Access denied for user 'grant_plug_dest'@'localhost' this should fail : not the same user GRANT PROXY ON grant_plug TO grant_plug_dest; @@ -139,15 +137,15 @@ ERROR 42000: You are not allowed to create a user with GRANT in default connection # test what root can grant should work : root has PROXY to all users -GRANT PROXY ON ''@'' TO grant_plug; -REVOKE PROXY ON ''@'' FROM grant_plug; +GRANT PROXY ON ''@'%%' TO grant_plug; +REVOKE PROXY ON ''@'%%' FROM grant_plug; should work : root has PROXY to all users -GRANT PROXY ON ''@'' TO proxy_admin IDENTIFIED BY 'test' +GRANT PROXY ON ''@'%%' TO proxy_admin IDENTIFIED BY 'test' WITH GRANT OPTION; need USAGE : PROXY doesn't contain it. GRANT USAGE on *.* TO proxy_admin; in proxy_admin_con; -should work : proxy_admin has proxy to ''@'' +should work : proxy_admin has proxy to ''@'%%' GRANT PROXY ON future_user TO grant_plug; in default connection SHOW GRANTS FOR grant_plug; @@ -234,25 +232,25 @@ DROP USER plug_dest; # Bug #56798 : Wrong credentials assigned when using a proxy user. # GRANT ALL PRIVILEGES ON *.* TO power_user; -GRANT USAGE ON anonymous_db.* TO ''@'' +GRANT USAGE ON anonymous_db.* TO ''@'%%' IDENTIFIED WITH 'test_plugin_server' AS 'power_user'; -GRANT PROXY ON power_user TO ''@''; +GRANT PROXY ON power_user TO ''@'%%'; CREATE DATABASE confidential_db; SELECT user(),current_user(),@@proxy_user; user() current_user() @@proxy_user -test_login_user@localhost power_user@% ''@'' +test_login_user@localhost power_user@% ''@'%%' DROP USER power_user; -DROP USER ''@''; +DROP USER ''@'%%'; DROP DATABASE confidential_db; # Test case #2 (crash with double grant proxy) -CREATE USER ''@'' IDENTIFIED WITH 'test_plugin_server' AS 'standard_user'; +CREATE USER ''@'%%' IDENTIFIED WITH 'test_plugin_server' AS 'standard_user'; CREATE USER standard_user; CREATE DATABASE shared; GRANT ALL PRIVILEGES ON shared.* TO standard_user; -GRANT PROXY ON standard_user TO ''@''; +GRANT PROXY ON standard_user TO ''@'%%'; #should not crash -GRANT PROXY ON standard_user TO ''@''; -DROP USER ''@''; +GRANT PROXY ON standard_user TO ''@'%%'; +DROP USER ''@'%%'; DROP USER standard_user; DROP DATABASE shared; # @@ -426,8 +424,6 @@ SELECT USER(),CURRENT_USER(); USER() CURRENT_USER() bug12818542@localhost bug12818542_dest@localhost SET PASSWORD = PASSWORD('bruhaha'); -Warnings: -Note 1699 SET PASSWORD has no significance for users authenticating via plugins SELECT USER(),CURRENT_USER(); USER() CURRENT_USER() bug12818542@localhost bug12818542_dest@localhost diff --git a/mysql-test/r/plugin_auth_qa.result b/mysql-test/r/plugin_auth_qa.result index 72d21994792..b86a01f6b52 100644 --- a/mysql-test/r/plugin_auth_qa.result +++ b/mysql-test/r/plugin_auth_qa.result @@ -303,7 +303,7 @@ grant_user test_plugin_server plug_dest CREATE USER plug_dest; DROP USER plug_dest; GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest; -ERROR 42000: Can't find any matching row in the user table +ERROR 28000: Can't find any matching row in the user table DROP USER grant_user; GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; diff --git a/mysql-test/r/plugin_auth_qa_1.result b/mysql-test/r/plugin_auth_qa_1.result index d700be36ac0..44b5a88de1e 100644 --- a/mysql-test/r/plugin_auth_qa_1.result +++ b/mysql-test/r/plugin_auth_qa_1.result @@ -186,7 +186,7 @@ connection default; disconnect plug_user; DROP USER new_user,new_dest,plug_dest; ========== test 2, 2.1, 2.2 ================================ -CREATE USER ''@'' IDENTIFIED WITH test_plugin_server AS 'proxied_user'; +CREATE USER ''@'%%' IDENTIFIED WITH test_plugin_server AS 'proxied_user'; CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; user plugin authentication_string @@ -204,7 +204,7 @@ connection default; disconnect proxy_con; connect(proxy_con,localhost,proxy_user,proxied_user); ERROR 28000: Access denied for user 'proxy_user'@'localhost' (using password: YES) -GRANT PROXY ON proxied_user TO ''@''; +GRANT PROXY ON proxied_user TO ''@'%%'; connect(proxy_con,localhost,proxied_user,proxied_user_passwd); SELECT USER(),CURRENT_USER(); USER() CURRENT_USER() @@ -218,11 +218,11 @@ proxy_user@localhost proxied_user@% ========== test 2.2.1 ====================================== SELECT @@proxy_user; @@proxy_user -''@'' +''@'%%' connection default; disconnect proxy_con; -DROP USER ''@'',proxied_user; -GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'' +DROP USER ''@'%%',proxied_user; +GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'%%' IDENTIFIED WITH test_plugin_server AS 'proxied_user'; CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; @@ -240,7 +240,7 @@ connection default; disconnect proxy_con; connect(proxy_con,localhost,proxy_user,proxied_user); ERROR 28000: Access denied for user 'proxy_user'@'localhost' (using password: YES) -GRANT PROXY ON proxied_user TO ''@''; +GRANT PROXY ON proxied_user TO ''@'%%'; connect(proxy_con,localhost,proxied_user,proxied_user_passwd); SELECT USER(),CURRENT_USER(); USER() CURRENT_USER() @@ -253,21 +253,21 @@ USER() CURRENT_USER() proxy_user@localhost proxied_user@% SELECT @@proxy_user; @@proxy_user -''@'' +''@'%%' connection default; disconnect proxy_con; -DROP USER ''@'',proxied_user; -CREATE USER ''@'' IDENTIFIED WITH test_plugin_server AS 'proxied_user'; +DROP USER ''@'%%',proxied_user; +CREATE USER ''@'%%' IDENTIFIED WITH test_plugin_server AS 'proxied_user'; CREATE USER proxied_user_1 IDENTIFIED BY 'proxied_user_1_pwd'; CREATE USER proxied_user_2 IDENTIFIED BY 'proxied_user_2_pwd'; CREATE USER proxied_user_3 IDENTIFIED BY 'proxied_user_3_pwd'; CREATE USER proxied_user_4 IDENTIFIED BY 'proxied_user_4_pwd'; CREATE USER proxied_user_5 IDENTIFIED BY 'proxied_user_5_pwd'; -GRANT PROXY ON proxied_user_1 TO ''@''; -GRANT PROXY ON proxied_user_2 TO ''@''; -GRANT PROXY ON proxied_user_3 TO ''@''; -GRANT PROXY ON proxied_user_4 TO ''@''; -GRANT PROXY ON proxied_user_5 TO ''@''; +GRANT PROXY ON proxied_user_1 TO ''@'%%'; +GRANT PROXY ON proxied_user_2 TO ''@'%%'; +GRANT PROXY ON proxied_user_3 TO ''@'%%'; +GRANT PROXY ON proxied_user_4 TO ''@'%%'; +GRANT PROXY ON proxied_user_5 TO ''@'%%'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; user plugin authentication_string test_plugin_server proxied_user @@ -322,7 +322,7 @@ disconnect proxy_con_2; disconnect proxy_con_3; disconnect proxy_con_4; disconnect proxy_con_5; -DROP USER ''@'',proxied_user_1,proxied_user_2,proxied_user_3,proxied_user_4,proxied_user_5; +DROP USER ''@'%%',proxied_user_1,proxied_user_2,proxied_user_3,proxied_user_4,proxied_user_5; ========== test 3 ========================================== GRANT ALL PRIVILEGES ON *.* TO plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest'; diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index f6a2a16f038..50fb5e1e55b 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -1201,13 +1201,13 @@ SET @aux= "SELECT COUNT(*) prepare my_stmt from @aux; execute my_stmt; COUNT(*) -43 +44 execute my_stmt; COUNT(*) -43 +44 execute my_stmt; COUNT(*) -43 +44 deallocate prepare my_stmt; drop procedure if exists p1| drop table if exists t1| diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index d41bfaa2c67..e169dcb40b0 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -221,27 +221,27 @@ update t1 set y=x; explain select * from t1, t1 t2 where t1.y = 8 and t2.x between 7 and t1.y+0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using join buffer (flat, BNL join) +1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using where; Using join buffer (flat, BNL join) explain select * from t1, t1 t2 where t1.y = 8 and t2.x >= 7 and t2.x <= t1.y+0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using join buffer (flat, BNL join) +1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using where; Using join buffer (flat, BNL join) explain select * from t1, t1 t2 where t1.y = 2 and t2.x between t1.y-1 and t1.y+1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 3 Using index condition; Using join buffer (flat, BNL join) +1 SIMPLE t2 range x x 5 NULL 3 Using index condition; Using where; Using join buffer (flat, BNL join) explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1.y+1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 3 Using index condition; Using join buffer (flat, BNL join) +1 SIMPLE t2 range x x 5 NULL 3 Using index condition; Using where; Using join buffer (flat, BNL join) explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using join buffer (flat, BNL join) +1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using where; Using join buffer (flat, BNL join) explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using join buffer (flat, BNL join) +1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using where; Using join buffer (flat, BNL join) explain select count(*) from t1 where x in (1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref x x 5 const 1 Using index diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result index a5c14d99975..0d6bfc2467b 100644 --- a/mysql-test/r/range_mrr_icp.result +++ b/mysql-test/r/range_mrr_icp.result @@ -223,27 +223,27 @@ update t1 set y=x; explain select * from t1, t1 t2 where t1.y = 8 and t2.x between 7 and t1.y+0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Rowid-ordered scan; Using join buffer (flat, BNL join) +1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) explain select * from t1, t1 t2 where t1.y = 8 and t2.x >= 7 and t2.x <= t1.y+0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Rowid-ordered scan; Using join buffer (flat, BNL join) +1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) explain select * from t1, t1 t2 where t1.y = 2 and t2.x between t1.y-1 and t1.y+1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 3 Using index condition; Rowid-ordered scan; Using join buffer (flat, BNL join) +1 SIMPLE t2 range x x 5 NULL 3 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1.y+1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 3 Using index condition; Rowid-ordered scan; Using join buffer (flat, BNL join) +1 SIMPLE t2 range x x 5 NULL 3 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Rowid-ordered scan; Using join buffer (flat, BNL join) +1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Rowid-ordered scan; Using join buffer (flat, BNL join) +1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) explain select count(*) from t1 where x in (1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref x x 5 const 1 Using index diff --git a/mysql-test/r/skip_grants.result b/mysql-test/r/skip_grants.result index cd691d882fa..b178e0ecfa7 100644 --- a/mysql-test/r/skip_grants.result +++ b/mysql-test/r/skip_grants.result @@ -36,14 +36,14 @@ CREATE DEFINER=a@'' FUNCTION f3() RETURNS INT RETURN 3; SHOW CREATE VIEW v3; View Create View character_set_client collation_connection -v3 CREATE ALGORITHM=UNDEFINED DEFINER=`a`@`` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`c` AS `c` from `t1` latin1 latin1_swedish_ci +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`a`@`%` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`c` AS `c` from `t1` latin1 latin1_swedish_ci SHOW CREATE PROCEDURE p3; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p3 CREATE DEFINER=`a`@`` PROCEDURE `p3`() +p3 CREATE DEFINER=`a`@`%` PROCEDURE `p3`() SELECT 3 latin1 latin1_swedish_ci latin1_swedish_ci SHOW CREATE FUNCTION f3; Function sql_mode Create Function character_set_client collation_connection Database Collation -f3 CREATE DEFINER=`a`@`` FUNCTION `f3`() RETURNS int(11) +f3 CREATE DEFINER=`a`@`%` FUNCTION `f3`() RETURNS int(11) RETURN 3 latin1 latin1_swedish_ci latin1_swedish_ci DROP TRIGGER t1_bi; DROP TRIGGER ti_ai; diff --git a/mysql-test/r/sp_notembedded.result b/mysql-test/r/sp_notembedded.result index e95bae39920..410441b63e3 100644 --- a/mysql-test/r/sp_notembedded.result +++ b/mysql-test/r/sp_notembedded.result @@ -9,11 +9,11 @@ end| call bug4902()| Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION call bug4902()| Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION drop procedure bug4902| drop procedure if exists bug4902_2| create procedure bug4902_2() @@ -156,11 +156,11 @@ create procedure 15298_2 () sql security definer show grants; call 15298_1(); Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION call 15298_2(); Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION drop user mysqltest_1@localhost; drop procedure 15298_1; drop procedure 15298_2; diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result index e1c9df3b00b..05635dd0985 100644 --- a/mysql-test/r/subselect_mat.result +++ b/mysql-test/r/subselect_mat.result @@ -1474,7 +1474,7 @@ EXPLAIN SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Rowid-ordered scan +2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using where; Rowid-ordered scan SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0); pk 2 @@ -2158,7 +2158,7 @@ EXPLAIN SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 2 Using index condition +2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using where SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0); pk 2 diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result index 51e5c5e54d0..b8040731cb5 100644 --- a/mysql-test/r/subselect_sj.result +++ b/mysql-test/r/subselect_sj.result @@ -803,7 +803,7 @@ EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 11 func,func 1 100.00 -2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Rowid-ordered scan +2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`pk` > 0)) SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk > 0); diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result index 73777dd71c3..a42fc1efaad 100644 --- a/mysql-test/r/subselect_sj_jcl6.result +++ b/mysql-test/r/subselect_sj_jcl6.result @@ -816,7 +816,7 @@ EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 11 func,func 1 100.00 -2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Rowid-ordered scan +2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`pk` > 0)) SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk > 0); diff --git a/mysql-test/r/subselect_sj_mat.result b/mysql-test/r/subselect_sj_mat.result index bcdd82b790c..15cb9eeaa0e 100644 --- a/mysql-test/r/subselect_sj_mat.result +++ b/mysql-test/r/subselect_sj_mat.result @@ -1511,7 +1511,7 @@ EXPLAIN SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Rowid-ordered scan +2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using where; Rowid-ordered scan SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0); pk 2 diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index eda11d95b22..fa9195e705b 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -19,6 +19,7 @@ plugin proc procs_priv proxies_priv +roles_mapping servers slow_log table_stats @@ -128,6 +129,7 @@ user CREATE TABLE `user` ( `plugin` char(64) CHARACTER SET latin1 NOT NULL DEFAULT '', `authentication_string` text COLLATE utf8_bin NOT NULL, `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', PRIMARY KEY (`Host`,`User`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges' show create table func; diff --git a/mysql-test/r/system_mysql_db_fix40123.result b/mysql-test/r/system_mysql_db_fix40123.result index 71e94a7432d..0d6349a9b2f 100644 --- a/mysql-test/r/system_mysql_db_fix40123.result +++ b/mysql-test/r/system_mysql_db_fix40123.result @@ -19,6 +19,7 @@ plugin proc procs_priv proxies_priv +roles_mapping servers slow_log table_stats @@ -125,6 +126,7 @@ user CREATE TABLE `user` ( `max_updates` int(11) unsigned NOT NULL DEFAULT '0', `max_connections` int(11) unsigned NOT NULL DEFAULT '0', `max_user_connections` int(11) NOT NULL DEFAULT '0', + `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `plugin` char(64) CHARACTER SET latin1 NOT NULL DEFAULT '', `authentication_string` text COLLATE utf8_bin NOT NULL, `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', diff --git a/mysql-test/r/system_mysql_db_fix50030.result b/mysql-test/r/system_mysql_db_fix50030.result index 71e94a7432d..0d6349a9b2f 100644 --- a/mysql-test/r/system_mysql_db_fix50030.result +++ b/mysql-test/r/system_mysql_db_fix50030.result @@ -19,6 +19,7 @@ plugin proc procs_priv proxies_priv +roles_mapping servers slow_log table_stats @@ -125,6 +126,7 @@ user CREATE TABLE `user` ( `max_updates` int(11) unsigned NOT NULL DEFAULT '0', `max_connections` int(11) unsigned NOT NULL DEFAULT '0', `max_user_connections` int(11) NOT NULL DEFAULT '0', + `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `plugin` char(64) CHARACTER SET latin1 NOT NULL DEFAULT '', `authentication_string` text COLLATE utf8_bin NOT NULL, `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', diff --git a/mysql-test/r/system_mysql_db_fix50117.result b/mysql-test/r/system_mysql_db_fix50117.result index 71e94a7432d..0d6349a9b2f 100644 --- a/mysql-test/r/system_mysql_db_fix50117.result +++ b/mysql-test/r/system_mysql_db_fix50117.result @@ -19,6 +19,7 @@ plugin proc procs_priv proxies_priv +roles_mapping servers slow_log table_stats @@ -125,6 +126,7 @@ user CREATE TABLE `user` ( `max_updates` int(11) unsigned NOT NULL DEFAULT '0', `max_connections` int(11) unsigned NOT NULL DEFAULT '0', `max_user_connections` int(11) NOT NULL DEFAULT '0', + `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `plugin` char(64) CHARACTER SET latin1 NOT NULL DEFAULT '', `authentication_string` text COLLATE utf8_bin NOT NULL, `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', diff --git a/mysql-test/r/trigger_notembedded.result b/mysql-test/r/trigger_notembedded.result index 0597a52a674..ef86e4c496c 100644 --- a/mysql-test/r/trigger_notembedded.result +++ b/mysql-test/r/trigger_notembedded.result @@ -162,7 +162,7 @@ SELECT trigger_name, definer FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_n trigger_name definer trg1 trg2 @ -trg3 @abc@def@@ +trg3 @abc@def@@% trg4 @hostname trg5 @abcdef@@@hostname @@ -170,7 +170,7 @@ SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name; TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION def mysqltest_db1 trg1 INSERT def mysqltest_db1 t1 0 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW NULL latin1 latin1_swedish_ci latin1_swedish_ci def mysqltest_db1 trg2 INSERT def mysqltest_db1 t1 0 NULL SET @a = 2 ROW AFTER NULL NULL OLD NEW NULL @ latin1 latin1_swedish_ci latin1_swedish_ci -def mysqltest_db1 trg3 UPDATE def mysqltest_db1 t1 0 NULL SET @a = 3 ROW BEFORE NULL NULL OLD NEW NULL @abc@def@@ latin1 latin1_swedish_ci latin1_swedish_ci +def mysqltest_db1 trg3 UPDATE def mysqltest_db1 t1 0 NULL SET @a = 3 ROW BEFORE NULL NULL OLD NEW NULL @abc@def@@% latin1 latin1_swedish_ci latin1_swedish_ci def mysqltest_db1 trg4 UPDATE def mysqltest_db1 t1 0 NULL SET @a = 4 ROW AFTER NULL NULL OLD NEW NULL @hostname latin1 latin1_swedish_ci latin1_swedish_ci def mysqltest_db1 trg5 DELETE def mysqltest_db1 t1 0 NULL SET @a = 5 ROW BEFORE NULL NULL OLD NEW NULL @abcdef@@@hostname latin1 latin1_swedish_ci latin1_swedish_ci diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result index 52e8cd54695..85e64078daf 100644 --- a/mysql-test/r/view_grant.result +++ b/mysql-test/r/view_grant.result @@ -523,13 +523,13 @@ drop user mysqltest_1@localhost; drop database mysqltest; create definer=some_user@`` sql security invoker view v1 as select 1; Warnings: -Note 1449 The user specified as a definer ('some_user'@'') does not exist +Note 1449 The user specified as a definer ('some_user'@'%') does not exist create definer=some_user@localhost sql security invoker view v2 as select 1; Warnings: Note 1449 The user specified as a definer ('some_user'@'localhost') does not exist show create view v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`%` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1` latin1 latin1_swedish_ci show create view v2; View Create View character_set_client collation_connection v2 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select 1 AS `1` latin1 latin1_swedish_ci diff --git a/mysql-test/suite/federated/federatedx.test b/mysql-test/suite/federated/federatedx.test index cfe6a425944..818cc2c1681 100644 --- a/mysql-test/suite/federated/federatedx.test +++ b/mysql-test/suite/federated/federatedx.test @@ -4,8 +4,8 @@ # ---source include/federated.inc --source have_federatedx.inc +--source include/federated.inc connection default; diff --git a/mysql-test/suite/federated/have_federatedx.opt b/mysql-test/suite/federated/have_federatedx.opt index 05d01b26b29..2c34f634517 100644 --- a/mysql-test/suite/federated/have_federatedx.opt +++ b/mysql-test/suite/federated/have_federatedx.opt @@ -1 +1 @@ ---plugin-load-add=$HA_FEDERATEDX_SO --federated +--plugin-load-add=$HA_FEDERATEDX_SO --loose-federated diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_03e.result b/mysql-test/suite/funcs_1/r/innodb_trig_03e.result index 5dfc734cf5c..cf93657885c 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_03e.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_03e.result @@ -573,7 +573,7 @@ root@localhost show grants; Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION drop trigger trg1_1; use priv_db; diff --git a/mysql-test/suite/funcs_1/r/is_column_privileges.result b/mysql-test/suite/funcs_1/r/is_column_privileges.result index edf0a401697..a57970dbcaa 100644 --- a/mysql-test/suite/funcs_1/r/is_column_privileges.result +++ b/mysql-test/suite/funcs_1/r/is_column_privileges.result @@ -28,7 +28,7 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.COLUMN_PRIVILEGES; Field Type Null Key Default Extra -GRANTEE varchar(81) NO +GRANTEE varchar(190) NO TABLE_CATALOG varchar(512) NO TABLE_SCHEMA varchar(64) NO TABLE_NAME varchar(64) NO @@ -38,7 +38,7 @@ IS_GRANTABLE varchar(3) NO SHOW CREATE TABLE information_schema.COLUMN_PRIVILEGES; Table Create Table COLUMN_PRIVILEGES CREATE TEMPORARY TABLE `COLUMN_PRIVILEGES` ( - `GRANTEE` varchar(81) NOT NULL DEFAULT '', + `GRANTEE` varchar(190) NOT NULL DEFAULT '', `TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', `TABLE_NAME` varchar(64) NOT NULL DEFAULT '', @@ -48,7 +48,7 @@ COLUMN_PRIVILEGES CREATE TEMPORARY TABLE `COLUMN_PRIVILEGES` ( ) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW COLUMNS FROM information_schema.COLUMN_PRIVILEGES; Field Type Null Key Default Extra -GRANTEE varchar(81) NO +GRANTEE varchar(190) NO TABLE_CATALOG varchar(512) NO TABLE_SCHEMA varchar(64) NO TABLE_NAME varchar(64) NO diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result index a875d16b54a..0fb2b8988df 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is.result @@ -16,6 +16,9 @@ def information_schema ALL_PLUGINS PLUGIN_STATUS 3 NO varchar 16 48 NULL NULL N def information_schema ALL_PLUGINS PLUGIN_TYPE 4 NO varchar 80 240 NULL NULL NULL utf8 utf8_general_ci varchar(80) select def information_schema ALL_PLUGINS PLUGIN_TYPE_VERSION 5 NO varchar 20 60 NULL NULL NULL utf8 utf8_general_ci varchar(20) select def information_schema ALL_PLUGINS PLUGIN_VERSION 2 NO varchar 20 60 NULL NULL NULL utf8 utf8_general_ci varchar(20) select +def information_schema APPLICABLE_ROLES GRANTEE 1 NO varchar 190 570 NULL NULL NULL utf8 utf8_general_ci varchar(190) select +def information_schema APPLICABLE_ROLES IS_GRANTABLE 3 NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) select +def information_schema APPLICABLE_ROLES ROLE_NAME 2 NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select def information_schema CHARACTER_SETS CHARACTER_SET_NAME 1 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select def information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME 2 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select def information_schema CHARACTER_SETS DESCRIPTION 3 NO varchar 60 180 NULL NULL NULL utf8 utf8_general_ci varchar(60) select @@ -72,12 +75,13 @@ def information_schema COLUMNS TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL NU def information_schema COLUMNS TABLE_NAME 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema COLUMNS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema COLUMN_PRIVILEGES COLUMN_NAME 5 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema COLUMN_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL NULL utf8 utf8_general_ci varchar(81) select +def information_schema COLUMN_PRIVILEGES GRANTEE 1 NO varchar 190 570 NULL NULL NULL utf8 utf8_general_ci varchar(190) select def information_schema COLUMN_PRIVILEGES IS_GRANTABLE 7 NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) select def information_schema COLUMN_PRIVILEGES PRIVILEGE_TYPE 6 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema COLUMN_PRIVILEGES TABLE_CATALOG 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select def information_schema COLUMN_PRIVILEGES TABLE_NAME 4 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema COLUMN_PRIVILEGES TABLE_SCHEMA 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select +def information_schema ENABLED_ROLES ROLE_NAME 1 NULL YES varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select def information_schema ENGINES COMMENT 3 NO varchar 160 480 NULL NULL NULL utf8 utf8_general_ci varchar(160) select def information_schema ENGINES ENGINE 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema ENGINES SAVEPOINTS 6 NULL YES varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) select @@ -294,7 +298,7 @@ def information_schema SCHEMATA DEFAULT_CHARACTER_SET_NAME 3 NO varchar 32 96 N def information_schema SCHEMATA DEFAULT_COLLATION_NAME 4 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select def information_schema SCHEMATA SCHEMA_NAME 2 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema SCHEMATA SQL_PATH 5 NULL YES varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select -def information_schema SCHEMA_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL NULL utf8 utf8_general_ci varchar(81) select +def information_schema SCHEMA_PRIVILEGES GRANTEE 1 NO varchar 190 570 NULL NULL NULL utf8 utf8_general_ci varchar(190) select def information_schema SCHEMA_PRIVILEGES IS_GRANTABLE 5 NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) select def information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE 4 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema SCHEMA_PRIVILEGES TABLE_CATALOG 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select @@ -355,7 +359,7 @@ def information_schema TABLE_CONSTRAINTS CONSTRAINT_SCHEMA 2 NO varchar 64 192 def information_schema TABLE_CONSTRAINTS CONSTRAINT_TYPE 6 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema TABLE_CONSTRAINTS TABLE_NAME 5 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema TABLE_CONSTRAINTS TABLE_SCHEMA 4 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema TABLE_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL NULL utf8 utf8_general_ci varchar(81) select +def information_schema TABLE_PRIVILEGES GRANTEE 1 NO varchar 190 570 NULL NULL NULL utf8 utf8_general_ci varchar(190) select def information_schema TABLE_PRIVILEGES IS_GRANTABLE 6 NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) select def information_schema TABLE_PRIVILEGES PRIVILEGE_TYPE 5 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema TABLE_PRIVILEGES TABLE_CATALOG 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select @@ -388,7 +392,7 @@ def information_schema TRIGGERS SQL_MODE 18 NO varchar 8192 24576 NULL NULL NUL def information_schema TRIGGERS TRIGGER_CATALOG 1 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select def information_schema TRIGGERS TRIGGER_NAME 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema TRIGGERS TRIGGER_SCHEMA 2 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema USER_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL NULL utf8 utf8_general_ci varchar(81) select +def information_schema USER_PRIVILEGES GRANTEE 1 NO varchar 190 570 NULL NULL NULL utf8 utf8_general_ci varchar(190) select def information_schema USER_PRIVILEGES IS_GRANTABLE 4 NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) select def information_schema USER_PRIVILEGES PRIVILEGE_TYPE 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema USER_PRIVILEGES TABLE_CATALOG 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select @@ -500,6 +504,9 @@ COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH C 3.0000 information_schema ALL_PLUGINS LOAD_OPTION varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema ALL_PLUGINS PLUGIN_MATURITY varchar 12 36 utf8 utf8_general_ci varchar(12) 3.0000 information_schema ALL_PLUGINS PLUGIN_AUTH_VERSION varchar 80 240 utf8 utf8_general_ci varchar(80) +3.0000 information_schema APPLICABLE_ROLES GRANTEE varchar 190 570 utf8 utf8_general_ci varchar(190) +3.0000 information_schema APPLICABLE_ROLES ROLE_NAME varchar 128 384 utf8 utf8_general_ci varchar(128) +3.0000 information_schema APPLICABLE_ROLES IS_GRANTABLE varchar 3 9 utf8 utf8_general_ci varchar(3) 3.0000 information_schema CHARACTER_SETS CHARACTER_SET_NAME varchar 32 96 utf8 utf8_general_ci varchar(32) 3.0000 information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME varchar 32 96 utf8 utf8_general_ci varchar(32) 3.0000 information_schema CHARACTER_SETS DESCRIPTION varchar 60 180 utf8 utf8_general_ci varchar(60) @@ -555,13 +562,14 @@ NULL information_schema COLUMNS DATETIME_PRECISION bigint NULL NULL NULL NULL bi 3.0000 information_schema COLUMNS EXTRA varchar 27 81 utf8 utf8_general_ci varchar(27) 3.0000 information_schema COLUMNS PRIVILEGES varchar 80 240 utf8 utf8_general_ci varchar(80) 3.0000 information_schema COLUMNS COLUMN_COMMENT varchar 1024 3072 utf8 utf8_general_ci varchar(1024) -3.0000 information_schema COLUMN_PRIVILEGES GRANTEE varchar 81 243 utf8 utf8_general_ci varchar(81) +3.0000 information_schema COLUMN_PRIVILEGES GRANTEE varchar 190 570 utf8 utf8_general_ci varchar(190) 3.0000 information_schema COLUMN_PRIVILEGES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) 3.0000 information_schema COLUMN_PRIVILEGES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema COLUMN_PRIVILEGES TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema COLUMN_PRIVILEGES COLUMN_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema COLUMN_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema COLUMN_PRIVILEGES IS_GRANTABLE varchar 3 9 utf8 utf8_general_ci varchar(3) +3.0000 information_schema ENABLED_ROLES ROLE_NAME varchar 128 384 utf8 utf8_general_ci varchar(128) 3.0000 information_schema ENGINES ENGINE varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema ENGINES SUPPORT varchar 8 24 utf8 utf8_general_ci varchar(8) 3.0000 information_schema ENGINES COMMENT varchar 160 480 utf8 utf8_general_ci varchar(160) @@ -778,7 +786,7 @@ NULL information_schema ROUTINES LAST_ALTERED datetime NULL NULL NULL NULL datet 3.0000 information_schema SCHEMATA DEFAULT_CHARACTER_SET_NAME varchar 32 96 utf8 utf8_general_ci varchar(32) 3.0000 information_schema SCHEMATA DEFAULT_COLLATION_NAME varchar 32 96 utf8 utf8_general_ci varchar(32) 3.0000 information_schema SCHEMATA SQL_PATH varchar 512 1536 utf8 utf8_general_ci varchar(512) -3.0000 information_schema SCHEMA_PRIVILEGES GRANTEE varchar 81 243 utf8 utf8_general_ci varchar(81) +3.0000 information_schema SCHEMA_PRIVILEGES GRANTEE varchar 190 570 utf8 utf8_general_ci varchar(190) 3.0000 information_schema SCHEMA_PRIVILEGES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) 3.0000 information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) @@ -839,7 +847,7 @@ NULL information_schema TABLESPACES NODEGROUP_ID bigint NULL NULL NULL NULL bigi 3.0000 information_schema TABLE_CONSTRAINTS TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema TABLE_CONSTRAINTS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema TABLE_CONSTRAINTS CONSTRAINT_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) -3.0000 information_schema TABLE_PRIVILEGES GRANTEE varchar 81 243 utf8 utf8_general_ci varchar(81) +3.0000 information_schema TABLE_PRIVILEGES GRANTEE varchar 190 570 utf8 utf8_general_ci varchar(190) 3.0000 information_schema TABLE_PRIVILEGES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) 3.0000 information_schema TABLE_PRIVILEGES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema TABLE_PRIVILEGES TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) @@ -872,7 +880,7 @@ NULL information_schema TRIGGERS CREATED datetime NULL NULL NULL NULL datetime 3.0000 information_schema TRIGGERS CHARACTER_SET_CLIENT varchar 32 96 utf8 utf8_general_ci varchar(32) 3.0000 information_schema TRIGGERS COLLATION_CONNECTION varchar 32 96 utf8 utf8_general_ci varchar(32) 3.0000 information_schema TRIGGERS DATABASE_COLLATION varchar 32 96 utf8 utf8_general_ci varchar(32) -3.0000 information_schema USER_PRIVILEGES GRANTEE varchar 81 243 utf8 utf8_general_ci varchar(81) +3.0000 information_schema USER_PRIVILEGES GRANTEE varchar 190 570 utf8 utf8_general_ci varchar(190) 3.0000 information_schema USER_PRIVILEGES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) 3.0000 information_schema USER_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema USER_PRIVILEGES IS_GRANTABLE varchar 3 9 utf8 utf8_general_ci varchar(3) diff --git a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result index 7b8074f82f2..76b7571fb7d 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result @@ -16,6 +16,9 @@ def information_schema ALL_PLUGINS PLUGIN_STATUS 3 NO varchar 16 48 NULL NULL N def information_schema ALL_PLUGINS PLUGIN_TYPE 4 NO varchar 80 240 NULL NULL NULL utf8 utf8_general_ci varchar(80) def information_schema ALL_PLUGINS PLUGIN_TYPE_VERSION 5 NO varchar 20 60 NULL NULL NULL utf8 utf8_general_ci varchar(20) def information_schema ALL_PLUGINS PLUGIN_VERSION 2 NO varchar 20 60 NULL NULL NULL utf8 utf8_general_ci varchar(20) +def information_schema APPLICABLE_ROLES GRANTEE 1 NO varchar 190 570 NULL NULL NULL utf8 utf8_general_ci varchar(190) +def information_schema APPLICABLE_ROLES IS_GRANTABLE 3 NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) +def information_schema APPLICABLE_ROLES ROLE_NAME 2 NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) def information_schema CHARACTER_SETS CHARACTER_SET_NAME 1 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) def information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME 2 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) def information_schema CHARACTER_SETS DESCRIPTION 3 NO varchar 60 180 NULL NULL NULL utf8 utf8_general_ci varchar(60) @@ -72,12 +75,13 @@ def information_schema COLUMNS TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL NU def information_schema COLUMNS TABLE_NAME 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema COLUMNS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema COLUMN_PRIVILEGES COLUMN_NAME 5 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) -def information_schema COLUMN_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL NULL utf8 utf8_general_ci varchar(81) +def information_schema COLUMN_PRIVILEGES GRANTEE 1 NO varchar 190 570 NULL NULL NULL utf8 utf8_general_ci varchar(190) def information_schema COLUMN_PRIVILEGES IS_GRANTABLE 7 NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) def information_schema COLUMN_PRIVILEGES PRIVILEGE_TYPE 6 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema COLUMN_PRIVILEGES TABLE_CATALOG 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) def information_schema COLUMN_PRIVILEGES TABLE_NAME 4 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema COLUMN_PRIVILEGES TABLE_SCHEMA 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) +def information_schema ENABLED_ROLES ROLE_NAME 1 NULL YES varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) def information_schema ENGINES COMMENT 3 NO varchar 160 480 NULL NULL NULL utf8 utf8_general_ci varchar(160) def information_schema ENGINES ENGINE 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema ENGINES SAVEPOINTS 6 NULL YES varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) @@ -294,7 +298,7 @@ def information_schema SCHEMATA DEFAULT_CHARACTER_SET_NAME 3 NO varchar 32 96 N def information_schema SCHEMATA DEFAULT_COLLATION_NAME 4 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) def information_schema SCHEMATA SCHEMA_NAME 2 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema SCHEMATA SQL_PATH 5 NULL YES varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) -def information_schema SCHEMA_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL NULL utf8 utf8_general_ci varchar(81) +def information_schema SCHEMA_PRIVILEGES GRANTEE 1 NO varchar 190 570 NULL NULL NULL utf8 utf8_general_ci varchar(190) def information_schema SCHEMA_PRIVILEGES IS_GRANTABLE 5 NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) def information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE 4 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema SCHEMA_PRIVILEGES TABLE_CATALOG 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) @@ -355,7 +359,7 @@ def information_schema TABLE_CONSTRAINTS CONSTRAINT_SCHEMA 2 NO varchar 64 192 def information_schema TABLE_CONSTRAINTS CONSTRAINT_TYPE 6 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema TABLE_CONSTRAINTS TABLE_NAME 5 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema TABLE_CONSTRAINTS TABLE_SCHEMA 4 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) -def information_schema TABLE_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL NULL utf8 utf8_general_ci varchar(81) +def information_schema TABLE_PRIVILEGES GRANTEE 1 NO varchar 190 570 NULL NULL NULL utf8 utf8_general_ci varchar(190) def information_schema TABLE_PRIVILEGES IS_GRANTABLE 6 NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) def information_schema TABLE_PRIVILEGES PRIVILEGE_TYPE 5 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema TABLE_PRIVILEGES TABLE_CATALOG 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) @@ -388,7 +392,7 @@ def information_schema TRIGGERS SQL_MODE 18 NO varchar 8192 24576 NULL NULL NUL def information_schema TRIGGERS TRIGGER_CATALOG 1 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) def information_schema TRIGGERS TRIGGER_NAME 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema TRIGGERS TRIGGER_SCHEMA 2 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) -def information_schema USER_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL NULL utf8 utf8_general_ci varchar(81) +def information_schema USER_PRIVILEGES GRANTEE 1 NO varchar 190 570 NULL NULL NULL utf8 utf8_general_ci varchar(190) def information_schema USER_PRIVILEGES IS_GRANTABLE 4 NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) def information_schema USER_PRIVILEGES PRIVILEGE_TYPE 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema USER_PRIVILEGES TABLE_CATALOG 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) @@ -500,6 +504,9 @@ COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH C 3.0000 information_schema ALL_PLUGINS LOAD_OPTION varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema ALL_PLUGINS PLUGIN_MATURITY varchar 12 36 utf8 utf8_general_ci varchar(12) 3.0000 information_schema ALL_PLUGINS PLUGIN_AUTH_VERSION varchar 80 240 utf8 utf8_general_ci varchar(80) +3.0000 information_schema APPLICABLE_ROLES GRANTEE varchar 190 570 utf8 utf8_general_ci varchar(190) +3.0000 information_schema APPLICABLE_ROLES ROLE_NAME varchar 128 384 utf8 utf8_general_ci varchar(128) +3.0000 information_schema APPLICABLE_ROLES IS_GRANTABLE varchar 3 9 utf8 utf8_general_ci varchar(3) 3.0000 information_schema CHARACTER_SETS CHARACTER_SET_NAME varchar 32 96 utf8 utf8_general_ci varchar(32) 3.0000 information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME varchar 32 96 utf8 utf8_general_ci varchar(32) 3.0000 information_schema CHARACTER_SETS DESCRIPTION varchar 60 180 utf8 utf8_general_ci varchar(60) @@ -555,13 +562,14 @@ NULL information_schema COLUMNS DATETIME_PRECISION bigint NULL NULL NULL NULL bi 3.0000 information_schema COLUMNS EXTRA varchar 27 81 utf8 utf8_general_ci varchar(27) 3.0000 information_schema COLUMNS PRIVILEGES varchar 80 240 utf8 utf8_general_ci varchar(80) 3.0000 information_schema COLUMNS COLUMN_COMMENT varchar 1024 3072 utf8 utf8_general_ci varchar(1024) -3.0000 information_schema COLUMN_PRIVILEGES GRANTEE varchar 81 243 utf8 utf8_general_ci varchar(81) +3.0000 information_schema COLUMN_PRIVILEGES GRANTEE varchar 190 570 utf8 utf8_general_ci varchar(190) 3.0000 information_schema COLUMN_PRIVILEGES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) 3.0000 information_schema COLUMN_PRIVILEGES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema COLUMN_PRIVILEGES TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema COLUMN_PRIVILEGES COLUMN_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema COLUMN_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema COLUMN_PRIVILEGES IS_GRANTABLE varchar 3 9 utf8 utf8_general_ci varchar(3) +3.0000 information_schema ENABLED_ROLES ROLE_NAME varchar 128 384 utf8 utf8_general_ci varchar(128) 3.0000 information_schema ENGINES ENGINE varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema ENGINES SUPPORT varchar 8 24 utf8 utf8_general_ci varchar(8) 3.0000 information_schema ENGINES COMMENT varchar 160 480 utf8 utf8_general_ci varchar(160) @@ -778,7 +786,7 @@ NULL information_schema ROUTINES LAST_ALTERED datetime NULL NULL NULL NULL datet 3.0000 information_schema SCHEMATA DEFAULT_CHARACTER_SET_NAME varchar 32 96 utf8 utf8_general_ci varchar(32) 3.0000 information_schema SCHEMATA DEFAULT_COLLATION_NAME varchar 32 96 utf8 utf8_general_ci varchar(32) 3.0000 information_schema SCHEMATA SQL_PATH varchar 512 1536 utf8 utf8_general_ci varchar(512) -3.0000 information_schema SCHEMA_PRIVILEGES GRANTEE varchar 81 243 utf8 utf8_general_ci varchar(81) +3.0000 information_schema SCHEMA_PRIVILEGES GRANTEE varchar 190 570 utf8 utf8_general_ci varchar(190) 3.0000 information_schema SCHEMA_PRIVILEGES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) 3.0000 information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) @@ -839,7 +847,7 @@ NULL information_schema TABLESPACES NODEGROUP_ID bigint NULL NULL NULL NULL bigi 3.0000 information_schema TABLE_CONSTRAINTS TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema TABLE_CONSTRAINTS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema TABLE_CONSTRAINTS CONSTRAINT_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) -3.0000 information_schema TABLE_PRIVILEGES GRANTEE varchar 81 243 utf8 utf8_general_ci varchar(81) +3.0000 information_schema TABLE_PRIVILEGES GRANTEE varchar 190 570 utf8 utf8_general_ci varchar(190) 3.0000 information_schema TABLE_PRIVILEGES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) 3.0000 information_schema TABLE_PRIVILEGES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema TABLE_PRIVILEGES TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) @@ -872,7 +880,7 @@ NULL information_schema TRIGGERS CREATED datetime NULL NULL NULL NULL datetime 3.0000 information_schema TRIGGERS CHARACTER_SET_CLIENT varchar 32 96 utf8 utf8_general_ci varchar(32) 3.0000 information_schema TRIGGERS COLLATION_CONNECTION varchar 32 96 utf8 utf8_general_ci varchar(32) 3.0000 information_schema TRIGGERS DATABASE_COLLATION varchar 32 96 utf8 utf8_general_ci varchar(32) -3.0000 information_schema USER_PRIVILEGES GRANTEE varchar 81 243 utf8 utf8_general_ci varchar(81) +3.0000 information_schema USER_PRIVILEGES GRANTEE varchar 190 570 utf8 utf8_general_ci varchar(190) 3.0000 information_schema USER_PRIVILEGES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) 3.0000 information_schema USER_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema USER_PRIVILEGES IS_GRANTABLE varchar 3 9 utf8 utf8_general_ci varchar(3) diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result index e2fba35c7f8..00667e8e9d0 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result @@ -154,6 +154,10 @@ def mysql proxies_priv Proxied_user 4 NO char 16 48 NULL NULL NULL utf8 utf8_bi def mysql proxies_priv Timestamp 7 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references def mysql proxies_priv User 2 NO char 16 48 NULL NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references def mysql proxies_priv With_grant 5 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(1) select,insert,update,references +def mysql roles_mapping Admin_option 4 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references +def mysql roles_mapping Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references +def mysql roles_mapping Role 3 NO char 16 48 NULL NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references +def mysql roles_mapping User 2 NO char 16 48 NULL NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references def mysql servers Db 3 NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references def mysql servers Host 2 NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references def mysql servers Owner 9 NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references @@ -218,6 +222,7 @@ def mysql user Grant_priv 14 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci e def mysql user Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references def mysql user Index_priv 16 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references def mysql user Insert_priv 5 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references +def mysql user is_role 44 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references def mysql user Lock_tables_priv 21 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references def mysql user max_connections 39 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned select,insert,update,references def mysql user max_questions 37 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned select,insert,update,references @@ -467,6 +472,10 @@ NULL mysql procs_priv Timestamp timestamp NULL NULL NULL NULL timestamp NULL mysql proxies_priv With_grant tinyint NULL NULL NULL NULL tinyint(1) 3.0000 mysql proxies_priv Grantor char 77 231 utf8 utf8_bin char(77) NULL mysql proxies_priv Timestamp timestamp NULL NULL NULL NULL timestamp +3.0000 mysql roles_mapping Host char 60 180 utf8 utf8_bin char(60) +3.0000 mysql roles_mapping User char 16 48 utf8 utf8_bin char(16) +3.0000 mysql roles_mapping Role char 16 48 utf8 utf8_bin char(16) +3.0000 mysql roles_mapping Admin_option enum 1 3 utf8 utf8_general_ci enum('N','Y') 3.0000 mysql servers Server_name char 64 192 utf8 utf8_general_ci char(64) 3.0000 mysql servers Host char 64 192 utf8 utf8_general_ci char(64) 3.0000 mysql servers Db char 64 192 utf8 utf8_general_ci char(64) @@ -556,3 +565,4 @@ NULL mysql user max_user_connections int NULL NULL NULL NULL int(11) 1.0000 mysql user plugin char 64 64 latin1 latin1_swedish_ci char(64) 1.0000 mysql user authentication_string text 65535 65535 utf8 utf8_bin text 3.0000 mysql user password_expired enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user is_role enum 1 3 utf8 utf8_general_ci enum('N','Y') diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result index 94e1ed45152..d3de1f1c2d6 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result @@ -154,6 +154,10 @@ def mysql proxies_priv Proxied_user 4 NO char 16 48 NULL NULL NULL utf8 utf8_bi def mysql proxies_priv Timestamp 7 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP def mysql proxies_priv User 2 NO char 16 48 NULL NULL NULL utf8 utf8_bin char(16) PRI def mysql proxies_priv With_grant 5 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(1) +def mysql roles_mapping Admin_option 4 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') +def mysql roles_mapping Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI +def mysql roles_mapping Role 3 NO char 16 48 NULL NULL NULL utf8 utf8_bin char(16) PRI +def mysql roles_mapping User 2 NO char 16 48 NULL NULL NULL utf8 utf8_bin char(16) PRI def mysql servers Db 3 NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) def mysql servers Host 2 NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) def mysql servers Owner 9 NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) @@ -218,6 +222,7 @@ def mysql user Grant_priv 14 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci e def mysql user Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI def mysql user Index_priv 16 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') def mysql user Insert_priv 5 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') +def mysql user is_role 44 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') def mysql user Lock_tables_priv 21 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') def mysql user max_connections 39 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned def mysql user max_questions 37 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned @@ -467,6 +472,10 @@ NULL mysql procs_priv Timestamp timestamp NULL NULL NULL NULL timestamp NULL mysql proxies_priv With_grant tinyint NULL NULL NULL NULL tinyint(1) 3.0000 mysql proxies_priv Grantor char 77 231 utf8 utf8_bin char(77) NULL mysql proxies_priv Timestamp timestamp NULL NULL NULL NULL timestamp +3.0000 mysql roles_mapping Host char 60 180 utf8 utf8_bin char(60) +3.0000 mysql roles_mapping User char 16 48 utf8 utf8_bin char(16) +3.0000 mysql roles_mapping Role char 16 48 utf8 utf8_bin char(16) +3.0000 mysql roles_mapping Admin_option enum 1 3 utf8 utf8_general_ci enum('N','Y') 3.0000 mysql servers Server_name char 64 192 utf8 utf8_general_ci char(64) 3.0000 mysql servers Host char 64 192 utf8 utf8_general_ci char(64) 3.0000 mysql servers Db char 64 192 utf8 utf8_general_ci char(64) @@ -556,3 +565,4 @@ NULL mysql user max_user_connections int NULL NULL NULL NULL int(11) 1.0000 mysql user plugin char 64 64 latin1 latin1_swedish_ci char(64) 1.0000 mysql user authentication_string text 65535 65535 utf8 utf8_bin text 3.0000 mysql user password_expired enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user is_role enum 1 3 utf8 utf8_general_ci enum('N','Y') diff --git a/mysql-test/suite/funcs_1/r/is_key_column_usage.result b/mysql-test/suite/funcs_1/r/is_key_column_usage.result index 75cd59604ff..e27b4d06d25 100644 --- a/mysql-test/suite/funcs_1/r/is_key_column_usage.result +++ b/mysql-test/suite/funcs_1/r/is_key_column_usage.result @@ -124,6 +124,9 @@ def mysql PRIMARY def mysql proxies_priv Host def mysql PRIMARY def mysql proxies_priv User def mysql PRIMARY def mysql proxies_priv Proxied_host def mysql PRIMARY def mysql proxies_priv Proxied_user +def mysql Host def mysql roles_mapping Host +def mysql Host def mysql roles_mapping User +def mysql Host def mysql roles_mapping Role def mysql PRIMARY def mysql servers Server_name def mysql PRIMARY def mysql table_stats db_name def mysql PRIMARY def mysql table_stats table_name diff --git a/mysql-test/suite/funcs_1/r/is_schema_privileges.result b/mysql-test/suite/funcs_1/r/is_schema_privileges.result index 40e9b8d8bd7..9d4b2a537d6 100644 --- a/mysql-test/suite/funcs_1/r/is_schema_privileges.result +++ b/mysql-test/suite/funcs_1/r/is_schema_privileges.result @@ -28,7 +28,7 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.SCHEMA_PRIVILEGES; Field Type Null Key Default Extra -GRANTEE varchar(81) NO +GRANTEE varchar(190) NO TABLE_CATALOG varchar(512) NO TABLE_SCHEMA varchar(64) NO PRIVILEGE_TYPE varchar(64) NO @@ -36,7 +36,7 @@ IS_GRANTABLE varchar(3) NO SHOW CREATE TABLE information_schema.SCHEMA_PRIVILEGES; Table Create Table SCHEMA_PRIVILEGES CREATE TEMPORARY TABLE `SCHEMA_PRIVILEGES` ( - `GRANTEE` varchar(81) NOT NULL DEFAULT '', + `GRANTEE` varchar(190) NOT NULL DEFAULT '', `TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', `PRIVILEGE_TYPE` varchar(64) NOT NULL DEFAULT '', @@ -44,7 +44,7 @@ SCHEMA_PRIVILEGES CREATE TEMPORARY TABLE `SCHEMA_PRIVILEGES` ( ) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW COLUMNS FROM information_schema.SCHEMA_PRIVILEGES; Field Type Null Key Default Extra -GRANTEE varchar(81) NO +GRANTEE varchar(190) NO TABLE_CATALOG varchar(512) NO TABLE_SCHEMA varchar(64) NO PRIVILEGE_TYPE varchar(64) NO diff --git a/mysql-test/suite/funcs_1/r/is_statistics.result b/mysql-test/suite/funcs_1/r/is_statistics.result index c1afeb8db9b..e800d9b63fd 100644 --- a/mysql-test/suite/funcs_1/r/is_statistics.result +++ b/mysql-test/suite/funcs_1/r/is_statistics.result @@ -131,6 +131,9 @@ def mysql proxies_priv mysql PRIMARY def mysql proxies_priv mysql PRIMARY def mysql proxies_priv mysql PRIMARY def mysql proxies_priv mysql Grantor +def mysql roles_mapping mysql Host +def mysql roles_mapping mysql Host +def mysql roles_mapping mysql Host def mysql servers mysql PRIMARY def mysql table_stats mysql PRIMARY def mysql table_stats mysql PRIMARY diff --git a/mysql-test/suite/funcs_1/r/is_statistics_mysql.result b/mysql-test/suite/funcs_1/r/is_statistics_mysql.result index 5dbf3bc1488..c9e21a12663 100644 --- a/mysql-test/suite/funcs_1/r/is_statistics_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_statistics_mysql.result @@ -59,6 +59,9 @@ def mysql proxies_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE def mysql proxies_priv 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE def mysql proxies_priv 0 mysql PRIMARY 3 Proxied_host A #CARD# NULL NULL BTREE def mysql proxies_priv 0 mysql PRIMARY 4 Proxied_user A #CARD# NULL NULL BTREE +def mysql roles_mapping 0 mysql Host 1 Host A #CARD# NULL NULL BTREE +def mysql roles_mapping 0 mysql Host 2 User A #CARD# NULL NULL BTREE +def mysql roles_mapping 0 mysql Host 3 Role A #CARD# NULL NULL BTREE def mysql servers 0 mysql PRIMARY 1 Server_name A #CARD# NULL NULL BTREE def mysql tables_priv 1 mysql Grantor 1 Grantor A #CARD# NULL NULL BTREE def mysql tables_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE diff --git a/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result index f818db6784e..dbe786d39ef 100644 --- a/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result @@ -59,6 +59,9 @@ def mysql proxies_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE def mysql proxies_priv 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE def mysql proxies_priv 0 mysql PRIMARY 3 Proxied_host A #CARD# NULL NULL BTREE def mysql proxies_priv 0 mysql PRIMARY 4 Proxied_user A #CARD# NULL NULL BTREE +def mysql roles_mapping 0 mysql Host 1 Host A #CARD# NULL NULL BTREE +def mysql roles_mapping 0 mysql Host 2 User A #CARD# NULL NULL BTREE +def mysql roles_mapping 0 mysql Host 3 Role A #CARD# NULL NULL BTREE def mysql servers 0 mysql PRIMARY 1 Server_name A #CARD# NULL NULL BTREE def mysql tables_priv 1 mysql Grantor 1 Grantor A #CARD# NULL NULL BTREE def mysql tables_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE @@ -133,6 +136,9 @@ def mysql proxies_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE def mysql proxies_priv 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE def mysql proxies_priv 0 mysql PRIMARY 3 Proxied_host A #CARD# NULL NULL BTREE def mysql proxies_priv 0 mysql PRIMARY 4 Proxied_user A #CARD# NULL NULL BTREE +def mysql roles_mapping 0 mysql Host 1 Host A #CARD# NULL NULL BTREE +def mysql roles_mapping 0 mysql Host 2 User A #CARD# NULL NULL BTREE +def mysql roles_mapping 0 mysql Host 3 Role A #CARD# NULL NULL BTREE def mysql servers 0 mysql PRIMARY 1 Server_name A #CARD# NULL NULL BTREE def mysql tables_priv 1 mysql Grantor 1 Grantor A #CARD# NULL NULL BTREE def mysql tables_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE diff --git a/mysql-test/suite/funcs_1/r/is_table_constraints.result b/mysql-test/suite/funcs_1/r/is_table_constraints.result index 0077f74396c..ea2dd5ccd98 100644 --- a/mysql-test/suite/funcs_1/r/is_table_constraints.result +++ b/mysql-test/suite/funcs_1/r/is_table_constraints.result @@ -78,6 +78,7 @@ def mysql PRIMARY mysql plugin def mysql PRIMARY mysql proc def mysql PRIMARY mysql procs_priv def mysql PRIMARY mysql proxies_priv +def mysql Host mysql roles_mapping def mysql PRIMARY mysql servers def mysql PRIMARY mysql table_stats def mysql PRIMARY mysql tables_priv diff --git a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result index 38f79f30068..05df41570cf 100644 --- a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result @@ -28,6 +28,7 @@ def mysql PRIMARY mysql plugin PRIMARY KEY def mysql PRIMARY mysql proc PRIMARY KEY def mysql PRIMARY mysql procs_priv PRIMARY KEY def mysql PRIMARY mysql proxies_priv PRIMARY KEY +def mysql Host mysql roles_mapping UNIQUE def mysql PRIMARY mysql servers PRIMARY KEY def mysql PRIMARY mysql tables_priv PRIMARY KEY def mysql PRIMARY mysql table_stats PRIMARY KEY diff --git a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result index 8195abd9657..fd13d67f07c 100644 --- a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result @@ -28,6 +28,7 @@ def mysql PRIMARY mysql plugin PRIMARY KEY def mysql PRIMARY mysql proc PRIMARY KEY def mysql PRIMARY mysql procs_priv PRIMARY KEY def mysql PRIMARY mysql proxies_priv PRIMARY KEY +def mysql Host mysql roles_mapping UNIQUE def mysql PRIMARY mysql servers PRIMARY KEY def mysql PRIMARY mysql tables_priv PRIMARY KEY def mysql PRIMARY mysql table_stats PRIMARY KEY @@ -63,6 +64,7 @@ def mysql PRIMARY mysql plugin PRIMARY KEY def mysql PRIMARY mysql proc PRIMARY KEY def mysql PRIMARY mysql procs_priv PRIMARY KEY def mysql PRIMARY mysql proxies_priv PRIMARY KEY +def mysql Host mysql roles_mapping UNIQUE def mysql PRIMARY mysql servers PRIMARY KEY def mysql PRIMARY mysql tables_priv PRIMARY KEY def mysql PRIMARY mysql table_stats PRIMARY KEY diff --git a/mysql-test/suite/funcs_1/r/is_table_privileges.result b/mysql-test/suite/funcs_1/r/is_table_privileges.result index 8f51d99b6db..f7e443bbd35 100644 --- a/mysql-test/suite/funcs_1/r/is_table_privileges.result +++ b/mysql-test/suite/funcs_1/r/is_table_privileges.result @@ -28,7 +28,7 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.TABLE_PRIVILEGES; Field Type Null Key Default Extra -GRANTEE varchar(81) NO +GRANTEE varchar(190) NO TABLE_CATALOG varchar(512) NO TABLE_SCHEMA varchar(64) NO TABLE_NAME varchar(64) NO @@ -37,7 +37,7 @@ IS_GRANTABLE varchar(3) NO SHOW CREATE TABLE information_schema.TABLE_PRIVILEGES; Table Create Table TABLE_PRIVILEGES CREATE TEMPORARY TABLE `TABLE_PRIVILEGES` ( - `GRANTEE` varchar(81) NOT NULL DEFAULT '', + `GRANTEE` varchar(190) NOT NULL DEFAULT '', `TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', `TABLE_NAME` varchar(64) NOT NULL DEFAULT '', @@ -46,7 +46,7 @@ TABLE_PRIVILEGES CREATE TEMPORARY TABLE `TABLE_PRIVILEGES` ( ) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW COLUMNS FROM information_schema.TABLE_PRIVILEGES; Field Type Null Key Default Extra -GRANTEE varchar(81) NO +GRANTEE varchar(190) NO TABLE_CATALOG varchar(512) NO TABLE_SCHEMA varchar(64) NO TABLE_NAME varchar(64) NO diff --git a/mysql-test/suite/funcs_1/r/is_tables_is.result b/mysql-test/suite/funcs_1/r/is_tables_is.result index 5d3770c42de..5ecac2f296f 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_is.result +++ b/mysql-test/suite/funcs_1/r/is_tables_is.result @@ -39,6 +39,29 @@ user_comment Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA information_schema +TABLE_NAME APPLICABLE_ROLES +TABLE_TYPE SYSTEM VIEW +ENGINE MEMORY +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA information_schema TABLE_NAME CHARACTER_SETS TABLE_TYPE SYSTEM VIEW ENGINE MEMORY @@ -177,6 +200,29 @@ user_comment Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA information_schema +TABLE_NAME ENABLED_ROLES +TABLE_TYPE SYSTEM VIEW +ENGINE MEMORY +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA information_schema TABLE_NAME ENGINES TABLE_TYPE SYSTEM VIEW ENGINE MEMORY @@ -862,6 +908,29 @@ user_comment Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA information_schema +TABLE_NAME APPLICABLE_ROLES +TABLE_TYPE SYSTEM VIEW +ENGINE MEMORY +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA information_schema TABLE_NAME CHARACTER_SETS TABLE_TYPE SYSTEM VIEW ENGINE MEMORY @@ -1000,6 +1069,29 @@ user_comment Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA information_schema +TABLE_NAME ENABLED_ROLES +TABLE_TYPE SYSTEM VIEW +ENGINE MEMORY +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA information_schema TABLE_NAME ENGINES TABLE_TYPE SYSTEM VIEW ENGINE MEMORY diff --git a/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result b/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result index 5d3770c42de..5ecac2f296f 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result @@ -39,6 +39,29 @@ user_comment Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA information_schema +TABLE_NAME APPLICABLE_ROLES +TABLE_TYPE SYSTEM VIEW +ENGINE MEMORY +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA information_schema TABLE_NAME CHARACTER_SETS TABLE_TYPE SYSTEM VIEW ENGINE MEMORY @@ -177,6 +200,29 @@ user_comment Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA information_schema +TABLE_NAME ENABLED_ROLES +TABLE_TYPE SYSTEM VIEW +ENGINE MEMORY +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA information_schema TABLE_NAME ENGINES TABLE_TYPE SYSTEM VIEW ENGINE MEMORY @@ -862,6 +908,29 @@ user_comment Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA information_schema +TABLE_NAME APPLICABLE_ROLES +TABLE_TYPE SYSTEM VIEW +ENGINE MEMORY +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA information_schema TABLE_NAME CHARACTER_SETS TABLE_TYPE SYSTEM VIEW ENGINE MEMORY @@ -1000,6 +1069,29 @@ user_comment Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA information_schema +TABLE_NAME ENABLED_ROLES +TABLE_TYPE SYSTEM VIEW +ENGINE MEMORY +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA information_schema TABLE_NAME ENGINES TABLE_TYPE SYSTEM VIEW ENGINE MEMORY diff --git a/mysql-test/suite/funcs_1/r/is_tables_mysql.result b/mysql-test/suite/funcs_1/r/is_tables_mysql.result index 4587538ea0b..1eeaba15838 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_tables_mysql.result @@ -451,6 +451,29 @@ user_comment User proxy privileges Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA mysql +TABLE_NAME roles_mapping +TABLE_TYPE BASE TABLE +ENGINE MYISAM_OR_MARIA +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_bin +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Granted roles +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA mysql TABLE_NAME servers TABLE_TYPE BASE TABLE ENGINE MYISAM_OR_MARIA diff --git a/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result index 1d0951c1de2..6c0b0db07eb 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result @@ -451,6 +451,29 @@ user_comment User proxy privileges Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA mysql +TABLE_NAME roles_mapping +TABLE_TYPE BASE TABLE +ENGINE MYISAM_OR_MARIA +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_bin +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Granted roles +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA mysql TABLE_NAME servers TABLE_TYPE BASE TABLE ENGINE MYISAM_OR_MARIA @@ -1134,6 +1157,29 @@ user_comment User proxy privileges Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA mysql +TABLE_NAME roles_mapping +TABLE_TYPE BASE TABLE +ENGINE MYISAM_OR_MARIA +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_bin +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Granted roles +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA mysql TABLE_NAME servers TABLE_TYPE BASE TABLE ENGINE MYISAM_OR_MARIA diff --git a/mysql-test/suite/funcs_1/r/is_user_privileges.result b/mysql-test/suite/funcs_1/r/is_user_privileges.result index 031067f2e64..030d7152121 100644 --- a/mysql-test/suite/funcs_1/r/is_user_privileges.result +++ b/mysql-test/suite/funcs_1/r/is_user_privileges.result @@ -28,21 +28,21 @@ DROP FUNCTION test.f1; ######################################################################### DESCRIBE information_schema.USER_PRIVILEGES; Field Type Null Key Default Extra -GRANTEE varchar(81) NO +GRANTEE varchar(190) NO TABLE_CATALOG varchar(512) NO PRIVILEGE_TYPE varchar(64) NO IS_GRANTABLE varchar(3) NO SHOW CREATE TABLE information_schema.USER_PRIVILEGES; Table Create Table USER_PRIVILEGES CREATE TEMPORARY TABLE `USER_PRIVILEGES` ( - `GRANTEE` varchar(81) NOT NULL DEFAULT '', + `GRANTEE` varchar(190) NOT NULL DEFAULT '', `TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', `PRIVILEGE_TYPE` varchar(64) NOT NULL DEFAULT '', `IS_GRANTABLE` varchar(3) NOT NULL DEFAULT '' ) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW COLUMNS FROM information_schema.USER_PRIVILEGES; Field Type Null Key Default Extra -GRANTEE varchar(81) NO +GRANTEE varchar(190) NO TABLE_CATALOG varchar(512) NO PRIVILEGE_TYPE varchar(64) NO IS_GRANTABLE varchar(3) NO @@ -130,6 +130,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser2 Password @@ -173,6 +174,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser3 Password @@ -216,6 +218,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N # # Add GRANT OPTION db_datadict.* to testuser1; GRANT UPDATE ON db_datadict.* TO 'testuser1'@'localhost' WITH GRANT OPTION; @@ -283,6 +286,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser2 Password @@ -326,6 +330,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser3 Password @@ -369,6 +374,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N # Establish connection testuser1 (user=testuser1) SELECT * FROM information_schema.user_privileges WHERE grantee LIKE '''testuser%''' @@ -422,6 +428,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser2 Password @@ -465,6 +472,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser3 Password @@ -508,6 +516,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N SHOW GRANTS; Grants for testuser1@localhost GRANT USAGE ON *.* TO 'testuser1'@'localhost' @@ -583,6 +592,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser2 Password @@ -626,6 +636,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser3 Password @@ -669,6 +680,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N GRANT SELECT ON *.* TO 'testuser1'@'localhost' WITH GRANT OPTION; # # Here <SELECT YES> is shown correctly for testuser1; @@ -736,6 +748,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser2 Password @@ -779,6 +792,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser3 Password @@ -822,6 +836,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N # Switch to connection testuser1 SELECT * FROM information_schema.user_privileges WHERE grantee LIKE '''testuser%''' @@ -875,6 +890,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser2 Password @@ -918,6 +934,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser3 Password @@ -961,6 +978,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N SHOW GRANTS; Grants for testuser1@localhost GRANT SELECT ON *.* TO 'testuser1'@'localhost' WITH GRANT OPTION @@ -1066,6 +1084,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser2 Password @@ -1109,6 +1128,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser3 Password @@ -1152,6 +1172,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N # Switch to connection testuser1 SELECT * FROM information_schema.user_privileges WHERE grantee LIKE '''testuser%''' @@ -1252,6 +1273,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser2 Password @@ -1295,6 +1317,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser3 Password @@ -1338,6 +1361,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N # Switch to connection testuser1 SELECT * FROM information_schema.user_privileges WHERE grantee LIKE '''testuser%''' @@ -1391,6 +1415,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser2 Password @@ -1434,6 +1459,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser3 Password @@ -1477,6 +1503,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N SHOW GRANTS; Grants for testuser1@localhost GRANT USAGE ON *.* TO 'testuser1'@'localhost' @@ -1537,6 +1564,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser2 Password @@ -1580,6 +1608,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser3 Password @@ -1623,6 +1652,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N SHOW GRANTS; Grants for testuser1@localhost GRANT USAGE ON *.* TO 'testuser1'@'localhost' @@ -1698,6 +1728,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser2 Password @@ -1741,6 +1772,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N Host localhost User testuser3 Password @@ -1784,6 +1816,7 @@ max_user_connections 0 plugin authentication_string password_expired N +is_role N # Switch to connection testuser1 SELECT * FROM information_schema.user_privileges WHERE grantee LIKE '''testuser%''' diff --git a/mysql-test/suite/funcs_1/r/memory_trig_03e.result b/mysql-test/suite/funcs_1/r/memory_trig_03e.result index 32252c93890..5f05f7c0af5 100644 --- a/mysql-test/suite/funcs_1/r/memory_trig_03e.result +++ b/mysql-test/suite/funcs_1/r/memory_trig_03e.result @@ -574,7 +574,7 @@ root@localhost show grants; Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION drop trigger trg1_1; use priv_db; diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_03e.result b/mysql-test/suite/funcs_1/r/myisam_trig_03e.result index 1b3342ea581..c34525a52f8 100644 --- a/mysql-test/suite/funcs_1/r/myisam_trig_03e.result +++ b/mysql-test/suite/funcs_1/r/myisam_trig_03e.result @@ -574,7 +574,7 @@ root@localhost show grants; Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION drop trigger trg1_1; use priv_db; diff --git a/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result b/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result index f4b60c8c252..f803780f57e 100644 --- a/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result +++ b/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result @@ -70,7 +70,7 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_ SHOW GRANTS; Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION CREATE INDEX i_processlist ON processlist (user); ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' DROP TABLE processlist; diff --git a/mysql-test/suite/funcs_1/r/processlist_priv_ps.result b/mysql-test/suite/funcs_1/r/processlist_priv_ps.result index 6efa1397796..70d88904e60 100644 --- a/mysql-test/suite/funcs_1/r/processlist_priv_ps.result +++ b/mysql-test/suite/funcs_1/r/processlist_priv_ps.result @@ -70,7 +70,7 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_ SHOW GRANTS; Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION CREATE INDEX i_processlist ON processlist (user); ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' DROP TABLE processlist; diff --git a/mysql-test/suite/funcs_1/t/is_engines_federated.opt b/mysql-test/suite/funcs_1/t/is_engines_federated.opt deleted file mode 100644 index 198144ce5ac..00000000000 --- a/mysql-test/suite/funcs_1/t/is_engines_federated.opt +++ /dev/null @@ -1,2 +0,0 @@ ---loose-federated ---plugin-load-add=$HA_FEDERATEDX_SO diff --git a/mysql-test/suite/perfschema/r/column_privilege.result b/mysql-test/suite/perfschema/r/column_privilege.result index b013ea3fcad..e4ad9200272 100644 --- a/mysql-test/suite/perfschema/r/column_privilege.result +++ b/mysql-test/suite/perfschema/r/column_privilege.result @@ -1,7 +1,7 @@ show grants; Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION grant usage on *.* to 'pfs_user_5'@localhost with GRANT OPTION; grant SELECT(thread_id, event_id) on performance_schema.events_waits_current to 'pfs_user_5'@localhost; diff --git a/mysql-test/suite/perfschema/r/digest_table_full.result b/mysql-test/suite/perfschema/r/digest_table_full.result index 51c6404e332..bba3bc8d9e5 100644 --- a/mysql-test/suite/perfschema/r/digest_table_full.result +++ b/mysql-test/suite/perfschema/r/digest_table_full.result @@ -113,7 +113,7 @@ SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR, SUM_ROWS_AFFECTED, SUM_WARN SUM_ERRORS FROM performance_schema.events_statements_summary_by_digest; SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR SUM_ROWS_AFFECTED SUM_WARNINGS SUM_ERRORS NULL NULL NULL 55 32 1 2 -statements_digest 9dc10607f0c5f847fdec5021ec55454c TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1 0 0 0 +statements_digest b7123a38bb99ce09f09d127df4e39b18 TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1 0 0 0 SHOW VARIABLES LIKE "performance_schema_digests_size"; Variable_name Value performance_schema_digests_size 2 diff --git a/mysql-test/suite/perfschema/r/ortho_iter.result b/mysql-test/suite/perfschema/r/ortho_iter.result index 0887b9e4c92..0eb5ff8c737 100644 --- a/mysql-test/suite/perfschema/r/ortho_iter.result +++ b/mysql-test/suite/perfschema/r/ortho_iter.result @@ -115,7 +115,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/privilege.result b/mysql-test/suite/perfschema/r/privilege.result index 85e46759f22..49d72fc499f 100644 --- a/mysql-test/suite/perfschema/r/privilege.result +++ b/mysql-test/suite/perfschema/r/privilege.result @@ -1,7 +1,7 @@ show grants; Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION grant ALL on *.* to 'pfs_user_1'@localhost with GRANT OPTION; grant ALL on performance_schema.* to 'pfs_user_2'@localhost with GRANT OPTION; diff --git a/mysql-test/suite/perfschema/r/privilege_table_io.result b/mysql-test/suite/perfschema/r/privilege_table_io.result index 9a50503e232..02e3ed7da62 100644 --- a/mysql-test/suite/perfschema/r/privilege_table_io.result +++ b/mysql-test/suite/perfschema/r/privilege_table_io.result @@ -46,7 +46,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 @@ -104,6 +104,7 @@ wait/io/table/sql/handler handler.cc: TABLE mysql db fetch NULL wait/io/table/sql/handler handler.cc: TABLE mysql proxies_priv fetch NULL wait/io/table/sql/handler handler.cc: TABLE mysql proxies_priv fetch NULL wait/io/table/sql/handler handler.cc: TABLE mysql proxies_priv fetch NULL +wait/io/table/sql/handler handler.cc: TABLE mysql roles_mapping fetch NULL wait/io/table/sql/handler handler.cc: TABLE mysql tables_priv fetch NULL wait/io/table/sql/handler handler.cc: TABLE mysql procs_priv fetch NULL wait/io/table/sql/handler handler.cc: TABLE mysql servers fetch NULL diff --git a/mysql-test/suite/perfschema/r/start_server_disable_idle.result b/mysql-test/suite/perfschema/r/start_server_disable_idle.result index edc3ab5199a..dc652f8bbbf 100644 --- a/mysql-test/suite/perfschema/r/start_server_disable_idle.result +++ b/mysql-test/suite/perfschema/r/start_server_disable_idle.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_disable_stages.result b/mysql-test/suite/perfschema/r/start_server_disable_stages.result index 5b5d9d3f975..2984360fad9 100644 --- a/mysql-test/suite/perfschema/r/start_server_disable_stages.result +++ b/mysql-test/suite/perfschema/r/start_server_disable_stages.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_disable_statements.result b/mysql-test/suite/perfschema/r/start_server_disable_statements.result index 039cd964a26..2f0cff977e7 100644 --- a/mysql-test/suite/perfschema/r/start_server_disable_statements.result +++ b/mysql-test/suite/perfschema/r/start_server_disable_statements.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_disable_waits.result b/mysql-test/suite/perfschema/r/start_server_disable_waits.result index 686933640a2..1a1062d3201 100644 --- a/mysql-test/suite/perfschema/r/start_server_disable_waits.result +++ b/mysql-test/suite/perfschema/r/start_server_disable_waits.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_innodb.result b/mysql-test/suite/perfschema/r/start_server_innodb.result index 212cee202c2..58d4e611812 100644 --- a/mysql-test/suite/perfschema/r/start_server_innodb.result +++ b/mysql-test/suite/perfschema/r/start_server_innodb.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_account.result b/mysql-test/suite/perfschema/r/start_server_no_account.result index 37b150d2bbc..cf5b5ba09e0 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_account.result +++ b/mysql-test/suite/perfschema/r/start_server_no_account.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result index de0e7deade7..805bb3a2cce 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result index 21cd2dae2cd..172ca779e18 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_class.result b/mysql-test/suite/perfschema/r/start_server_no_file_class.result index 2db110df4aa..e8c1580fd03 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_file_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_file_class.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result index 84b9b09cd80..02be2fe9585 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_host.result b/mysql-test/suite/perfschema/r/start_server_no_host.result index 6ef5d352c24..7d5fdaf7134 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_host.result +++ b/mysql-test/suite/perfschema/r/start_server_no_host.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result index 2ea53fb03d5..1ee6c681d01 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result index 91544690640..6d51baa0d2f 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result index 701c9ef1f3d..7bead1375fe 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result index 4076a36e70e..f4a6264e573 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 0 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result b/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result index 4e1d4d99c7b..6f2dc52e485 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result +++ b/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result b/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result index 6ba9e528ed1..210a5e677e9 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result +++ b/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_socket_class.result b/mysql-test/suite/perfschema/r/start_server_no_socket_class.result index 9805a87afb7..e495686fa63 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_socket_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_socket_class.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 0 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result b/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result index a3bacb07316..474875f2de7 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 0 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_stage_class.result b/mysql-test/suite/perfschema/r/start_server_no_stage_class.result index 31ea6354c8e..6ccd55451ac 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_stage_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_stage_class.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 0 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_stages_history.result b/mysql-test/suite/perfschema/r/start_server_no_stages_history.result index c398c4f5e6b..6443cba13df 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_stages_history.result +++ b/mysql-test/suite/perfschema/r/start_server_no_stages_history.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result index febdc87f8f9..ad44f26b880 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result +++ b/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_statements_history.result b/mysql-test/suite/perfschema/r/start_server_no_statements_history.result index 78520399866..cd21d415dad 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_statements_history.result +++ b/mysql-test/suite/perfschema/r/start_server_no_statements_history.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result index c45966bd74b..2fa222208b3 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result +++ b/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result b/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result index 0c35006b0de..46d18a2e354 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result +++ b/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 0 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_inst.result b/mysql-test/suite/perfschema/r/start_server_no_table_inst.result index 63e71dd7361..a098c3556f0 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_table_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_table_inst.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 0 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result index 7e87cf4363b..da1de089ef8 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 0 diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result index 5b0233d6727..e8663c0baf3 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_user.result b/mysql-test/suite/perfschema/r/start_server_no_user.result index 485110838ff..84c9da61842 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_user.result +++ b/mysql-test/suite/perfschema/r/start_server_no_user.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_waits_history.result b/mysql-test/suite/perfschema/r/start_server_no_waits_history.result index 1a692dfb5ae..ba1b38ec1ae 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_waits_history.result +++ b/mysql-test/suite/perfschema/r/start_server_no_waits_history.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result index 02ce9db20be..db1f905da73 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result +++ b/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_off.result b/mysql-test/suite/perfschema/r/start_server_off.result index d8bf697ea73..9d1259394a3 100644 --- a/mysql-test/suite/perfschema/r/start_server_off.result +++ b/mysql-test/suite/perfschema/r/start_server_off.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/start_server_on.result b/mysql-test/suite/perfschema/r/start_server_on.result index 212cee202c2..58d4e611812 100644 --- a/mysql-test/suite/perfschema/r/start_server_on.result +++ b/mysql-test/suite/perfschema/r/start_server_on.result @@ -93,7 +93,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/statement_digest.result b/mysql-test/suite/perfschema/r/statement_digest.result index 862239b015c..82bb1211cbc 100644 --- a/mysql-test/suite/perfschema/r/statement_digest.result +++ b/mysql-test/suite/perfschema/r/statement_digest.result @@ -112,43 +112,43 @@ DROP TRIGGER trg; SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR, SUM_ROWS_AFFECTED, SUM_WARNINGS, SUM_ERRORS FROM performance_schema.events_statements_summary_by_digest; SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR SUM_ROWS_AFFECTED SUM_WARNINGS SUM_ERRORS -statements_digest 9dc10607f0c5f847fdec5021ec55454c TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1 0 0 0 -statements_digest 70dfef34974722c072dfde594161c53f SELECT ? FROM t1 1 0 0 0 -statements_digest 92afc5f0de28802cf90bac0d2ecc28ea SELECT ? FROM `t1` 1 0 0 0 -statements_digest a3c82be9beb57590c35da4ffdde342f4 SELECT ?, ... FROM t1 2 0 0 0 -statements_digest 4aa210c131d9f75ee7acfea2b4f84f8e SELECT ? FROM t2 1 0 0 0 -statements_digest 4160fd3e7a59e6a4fab0d5188e306d8f SELECT ?, ... FROM t2 2 0 0 0 -statements_digest 033964070b3cfe70ea0e6edf21ab5595 INSERT INTO t1 VALUES (?) 1 1 0 0 -statements_digest cd2843f72a1484fb137664855d268a23 INSERT INTO t2 VALUES (?) 1 1 0 0 -statements_digest 51de047a21efe42b07e3af030330af0e INSERT INTO t3 VALUES (...) 4 4 0 0 -statements_digest 159f7021cd6b766d3f8f98d6f49c26c7 INSERT INTO t4 VALUES (...) 1 1 0 0 -statements_digest 0d298ad85eb763cfed01450d45ed311f INSERT INTO t5 VALUES (...) 1 1 0 0 -statements_digest 2872669f092c0878080b93d8d55a9efa INSERT INTO t1 VALUES (?) /* , ... */ 2 7 0 0 -statements_digest f8b8ffcea0840f0b796c04be7c4586a7 INSERT INTO t3 VALUES (...) /* , ... */ 1 3 0 0 -statements_digest ba4e21efb9e3704e86b2036505d76608 INSERT INTO t5 VALUES (...) /* , ... */ 1 3 0 0 -statements_digest 7b81bc3a5cc54098b68df4297456ca42 INSERT INTO t1 VALUES ( NULL ) 1 1 0 0 -statements_digest dc50d0a03e9f4c25493bbb660614a979 INSERT INTO t6 VALUES (...) 5 5 0 0 -statements_digest 772f22c3ca1b998449570d41d677b739 SELECT ? + ? 3 0 0 0 -statements_digest 4077abb1c6924eb2e61a4e6b5832e610 SELECT ? 1 0 0 0 -statements_digest dec987af5d13596c58a0b3382bf4be0a CREATE SCHEMA statements_digest_temp 2 2 0 0 -statements_digest 310050e7e30e166116fd9b04b9a39cec DROP SCHEMA statements_digest_temp 2 0 0 0 -statements_digest 1de70c587e0cc8f72f18f5532ea9ce41 SELECT ? FROM no_such_table 1 0 0 1 -statements_digest a0fcbd276415d695cbbd0ff9ea988fd1 CREATE TABLE dup_table ( c CHARACTER (?) ) 2 0 0 1 -statements_digest 47eff8114ef3ff7156ea1f894792a780 DROP TABLE dup_table 1 0 0 0 -statements_digest ca7b7a57283e104af725938959e04acc INSERT INTO t11 VALUES (?) 1 1 1 0 -statements_digest 09d296fc41f9a0a8e3badbfb548e69d9 SHOW WARNINGS 1 0 0 0 -statements_digest daef8b2773ba22b629205ac8d37275ba PREPARE stmt FROM ? 1 0 0 0 -statements_digest 933bf6630b020a5215edb27059bd68cc EXECUTE stmt 2 0 0 0 -statements_digest 45459d112476cdf389c4c43b25fe1751 DEALLOCATE PREPARE stmt 1 0 0 0 -statements_digest 317d254d2506653e151e8ca097fc8f18 CREATE PROCEDURE p1 ( ) BEGIN SELECT * FROM t12 ; END 1 0 0 0 -statements_digest 554e43a1cba81ed9076c04f39721c94b CALL p1 ( ) 2 0 0 0 -statements_digest aa9d2a149756e50d528de565a14d1d18 DROP PROCEDURE p1 1 0 0 0 -statements_digest e5674b0df28911bcb4fb4a1902b6e30a CREATE FUNCTION `func` ( a INTEGER , b INTEGER ) RETURNS INTEGER (?) RETURN a + b 1 0 0 0 -statements_digest a70c0561b972d4e50638d5ecdeef2ff1 SELECT func (...) 2 0 0 0 -statements_digest eba7f0de7c0682908b1810e99b3194e8 DROP FUNCTION func 1 0 0 0 -statements_digest 3f4217b75adb295c507c21edda9a7880 CREATE TRIGGER trg BEFORE INSERT ON t12 FOR EACH ROW SET @ ? := ? 1 0 0 0 -statements_digest 9628bd16a7f019ca3046a449ec9e4e30 INSERT INTO t12 VALUES (?) 2 2 0 0 -statements_digest d62fc8c82ef777e9c3af4f47743e0c46 DROP TRIGGER trg 1 0 0 0 +statements_digest b7123a38bb99ce09f09d127df4e39b18 TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1 0 0 0 +statements_digest b84133205e24517207248a0eefded78a SELECT ? FROM t1 1 0 0 0 +statements_digest 88a673e6a76a2bd1ad72dddc7e9be037 SELECT ? FROM `t1` 1 0 0 0 +statements_digest a885b0a3ae7886d11bfdc7c51b3d7110 SELECT ?, ... FROM t1 2 0 0 0 +statements_digest e3a97cc772f0acebfe7ee5537dfcc881 SELECT ? FROM t2 1 0 0 0 +statements_digest 9ecf822210da222eae9b56a0017765fc SELECT ?, ... FROM t2 2 0 0 0 +statements_digest 98bbad9fba6ace6566d118333c00c67d INSERT INTO t1 VALUES (?) 1 1 0 0 +statements_digest 724ab5bcd5f11b3975a65331c89443c0 INSERT INTO t2 VALUES (?) 1 1 0 0 +statements_digest a351a420a8ef3b894177d2620be682ca INSERT INTO t3 VALUES (...) 4 4 0 0 +statements_digest f66804d1ba3de87895f9a82c6cef04d4 INSERT INTO t4 VALUES (...) 1 1 0 0 +statements_digest 797b00d27cc1a212f4f4d61d3ad11e66 INSERT INTO t5 VALUES (...) 1 1 0 0 +statements_digest 90427cb3f602eaa97b1cc97c0ef16d85 INSERT INTO t1 VALUES (?) /* , ... */ 2 7 0 0 +statements_digest 1691e787cfe88075cb3e9fd48ac4a52b INSERT INTO t3 VALUES (...) /* , ... */ 1 3 0 0 +statements_digest cf401a585c798da2f55f72b0a99ded18 INSERT INTO t5 VALUES (...) /* , ... */ 1 3 0 0 +statements_digest 1e25bc6303e3968077c586dab9c5562c INSERT INTO t1 VALUES ( NULL ) 1 1 0 0 +statements_digest 30f72e28c64b3e6ca888715a848cd085 INSERT INTO t6 VALUES (...) 5 5 0 0 +statements_digest 551dce993b267c981c5b3eb285c2fe57 SELECT ? + ? 3 0 0 0 +statements_digest d31e1af4dc7ed5fe3ff61c78db7b327e SELECT ? 1 0 0 0 +statements_digest 33003a7b4de282603814a057945694d3 CREATE SCHEMA statements_digest_temp 2 2 0 0 +statements_digest 6ce84f85f37b9996e3dcbed9d55b88dd DROP SCHEMA statements_digest_temp 2 0 0 0 +statements_digest 08c862f2422dd8464a3b7b96d9de1dfa SELECT ? FROM no_such_table 1 0 0 1 +statements_digest c41b789a3176e6dbd8157848c6ff4aaf CREATE TABLE dup_table ( c CHARACTER (?) ) 2 0 0 1 +statements_digest fe693f8cf543b249a89f9f76c363d9d5 DROP TABLE dup_table 1 0 0 0 +statements_digest 5a6a862982ca17eff9038f2d852d848f INSERT INTO t11 VALUES (?) 1 1 1 0 +statements_digest b72d811ed58c8f2ec01e110bcad3138b SHOW WARNINGS 1 0 0 0 +statements_digest 63e18c50006c39c70200e63e720a9f0a PREPARE stmt FROM ? 1 0 0 0 +statements_digest eac5a2c580910e14eb0894ef21a25353 EXECUTE stmt 2 0 0 0 +statements_digest 5f1eaa4567c93974669fc403159245db DEALLOCATE PREPARE stmt 1 0 0 0 +statements_digest acb8e84440f68ee053d486688dfc88b2 CREATE PROCEDURE p1 ( ) BEGIN SELECT * FROM t12 ; END 1 0 0 0 +statements_digest 44c11865a2c9cd9f884bca10564ac818 CALL p1 ( ) 2 0 0 0 +statements_digest fb004af2d0db6f35a97ccdbbc51343ef DROP PROCEDURE p1 1 0 0 0 +statements_digest 6566febd24d7b17c53f75785ce94936c CREATE FUNCTION `func` ( a INTEGER , b INTEGER ) RETURNS INTEGER (?) RETURN a + b 1 0 0 0 +statements_digest 5bc097b58c334afe0875d7b74d0eb86e SELECT func (...) 2 0 0 0 +statements_digest 183cce493d199f32fad2174aab485298 DROP FUNCTION func 1 0 0 0 +statements_digest b0f05e1bd191be18730e2e24801a448d CREATE TRIGGER trg BEFORE INSERT ON t12 FOR EACH ROW SET @ ? := ? 1 0 0 0 +statements_digest 4a20ca3773c57af8a3949b76f446505a INSERT INTO t12 VALUES (?) 2 2 0 0 +statements_digest b345f3bef14924fea5ce7129cd374576 DROP TRIGGER trg 1 0 0 0 #################################### # CLEANUP #################################### diff --git a/mysql-test/suite/perfschema/r/statement_digest_consumers.result b/mysql-test/suite/perfschema/r/statement_digest_consumers.result index 48f13c1ed01..62776d0dba5 100644 --- a/mysql-test/suite/perfschema/r/statement_digest_consumers.result +++ b/mysql-test/suite/perfschema/r/statement_digest_consumers.result @@ -125,43 +125,43 @@ DROP TRIGGER trg; #################################### SELECT schema_name, digest, digest_text, count_star FROM performance_schema.events_statements_summary_by_digest; schema_name digest digest_text count_star -statements_digest 9dc10607f0c5f847fdec5021ec55454c TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1 -statements_digest 70dfef34974722c072dfde594161c53f SELECT ? FROM t1 1 -statements_digest 92afc5f0de28802cf90bac0d2ecc28ea SELECT ? FROM `t1` 1 -statements_digest a3c82be9beb57590c35da4ffdde342f4 SELECT ?, ... FROM t1 2 -statements_digest 4aa210c131d9f75ee7acfea2b4f84f8e SELECT ? FROM t2 1 -statements_digest 4160fd3e7a59e6a4fab0d5188e306d8f SELECT ?, ... FROM t2 2 -statements_digest 033964070b3cfe70ea0e6edf21ab5595 INSERT INTO t1 VALUES (?) 1 -statements_digest cd2843f72a1484fb137664855d268a23 INSERT INTO t2 VALUES (?) 1 -statements_digest 51de047a21efe42b07e3af030330af0e INSERT INTO t3 VALUES (...) 4 -statements_digest 159f7021cd6b766d3f8f98d6f49c26c7 INSERT INTO t4 VALUES (...) 1 -statements_digest 0d298ad85eb763cfed01450d45ed311f INSERT INTO t5 VALUES (...) 1 -statements_digest 2872669f092c0878080b93d8d55a9efa INSERT INTO t1 VALUES (?) /* , ... */ 2 -statements_digest f8b8ffcea0840f0b796c04be7c4586a7 INSERT INTO t3 VALUES (...) /* , ... */ 1 -statements_digest ba4e21efb9e3704e86b2036505d76608 INSERT INTO t5 VALUES (...) /* , ... */ 1 -statements_digest 7b81bc3a5cc54098b68df4297456ca42 INSERT INTO t1 VALUES ( NULL ) 1 -statements_digest dc50d0a03e9f4c25493bbb660614a979 INSERT INTO t6 VALUES (...) 5 -statements_digest 772f22c3ca1b998449570d41d677b739 SELECT ? + ? 3 -statements_digest 4077abb1c6924eb2e61a4e6b5832e610 SELECT ? 1 -statements_digest dec987af5d13596c58a0b3382bf4be0a CREATE SCHEMA statements_digest_temp 2 -statements_digest 310050e7e30e166116fd9b04b9a39cec DROP SCHEMA statements_digest_temp 2 -statements_digest 1de70c587e0cc8f72f18f5532ea9ce41 SELECT ? FROM no_such_table 1 -statements_digest a0fcbd276415d695cbbd0ff9ea988fd1 CREATE TABLE dup_table ( c CHARACTER (?) ) 2 -statements_digest 47eff8114ef3ff7156ea1f894792a780 DROP TABLE dup_table 1 -statements_digest ca7b7a57283e104af725938959e04acc INSERT INTO t11 VALUES (?) 1 -statements_digest 09d296fc41f9a0a8e3badbfb548e69d9 SHOW WARNINGS 1 -statements_digest daef8b2773ba22b629205ac8d37275ba PREPARE stmt FROM ? 1 -statements_digest 933bf6630b020a5215edb27059bd68cc EXECUTE stmt 2 -statements_digest 45459d112476cdf389c4c43b25fe1751 DEALLOCATE PREPARE stmt 1 -statements_digest 317d254d2506653e151e8ca097fc8f18 CREATE PROCEDURE p1 ( ) BEGIN SELECT * FROM t12 ; END 1 -statements_digest 554e43a1cba81ed9076c04f39721c94b CALL p1 ( ) 2 -statements_digest aa9d2a149756e50d528de565a14d1d18 DROP PROCEDURE p1 1 -statements_digest e5674b0df28911bcb4fb4a1902b6e30a CREATE FUNCTION `func` ( a INTEGER , b INTEGER ) RETURNS INTEGER (?) RETURN a + b 1 -statements_digest a70c0561b972d4e50638d5ecdeef2ff1 SELECT func (...) 2 -statements_digest eba7f0de7c0682908b1810e99b3194e8 DROP FUNCTION func 1 -statements_digest 3f4217b75adb295c507c21edda9a7880 CREATE TRIGGER trg BEFORE INSERT ON t12 FOR EACH ROW SET @ ? := ? 1 -statements_digest 9628bd16a7f019ca3046a449ec9e4e30 INSERT INTO t12 VALUES (?) 2 -statements_digest d62fc8c82ef777e9c3af4f47743e0c46 DROP TRIGGER trg 1 +statements_digest b7123a38bb99ce09f09d127df4e39b18 TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1 +statements_digest b84133205e24517207248a0eefded78a SELECT ? FROM t1 1 +statements_digest 88a673e6a76a2bd1ad72dddc7e9be037 SELECT ? FROM `t1` 1 +statements_digest a885b0a3ae7886d11bfdc7c51b3d7110 SELECT ?, ... FROM t1 2 +statements_digest e3a97cc772f0acebfe7ee5537dfcc881 SELECT ? FROM t2 1 +statements_digest 9ecf822210da222eae9b56a0017765fc SELECT ?, ... FROM t2 2 +statements_digest 98bbad9fba6ace6566d118333c00c67d INSERT INTO t1 VALUES (?) 1 +statements_digest 724ab5bcd5f11b3975a65331c89443c0 INSERT INTO t2 VALUES (?) 1 +statements_digest a351a420a8ef3b894177d2620be682ca INSERT INTO t3 VALUES (...) 4 +statements_digest f66804d1ba3de87895f9a82c6cef04d4 INSERT INTO t4 VALUES (...) 1 +statements_digest 797b00d27cc1a212f4f4d61d3ad11e66 INSERT INTO t5 VALUES (...) 1 +statements_digest 90427cb3f602eaa97b1cc97c0ef16d85 INSERT INTO t1 VALUES (?) /* , ... */ 2 +statements_digest 1691e787cfe88075cb3e9fd48ac4a52b INSERT INTO t3 VALUES (...) /* , ... */ 1 +statements_digest cf401a585c798da2f55f72b0a99ded18 INSERT INTO t5 VALUES (...) /* , ... */ 1 +statements_digest 1e25bc6303e3968077c586dab9c5562c INSERT INTO t1 VALUES ( NULL ) 1 +statements_digest 30f72e28c64b3e6ca888715a848cd085 INSERT INTO t6 VALUES (...) 5 +statements_digest 551dce993b267c981c5b3eb285c2fe57 SELECT ? + ? 3 +statements_digest d31e1af4dc7ed5fe3ff61c78db7b327e SELECT ? 1 +statements_digest 33003a7b4de282603814a057945694d3 CREATE SCHEMA statements_digest_temp 2 +statements_digest 6ce84f85f37b9996e3dcbed9d55b88dd DROP SCHEMA statements_digest_temp 2 +statements_digest 08c862f2422dd8464a3b7b96d9de1dfa SELECT ? FROM no_such_table 1 +statements_digest c41b789a3176e6dbd8157848c6ff4aaf CREATE TABLE dup_table ( c CHARACTER (?) ) 2 +statements_digest fe693f8cf543b249a89f9f76c363d9d5 DROP TABLE dup_table 1 +statements_digest 5a6a862982ca17eff9038f2d852d848f INSERT INTO t11 VALUES (?) 1 +statements_digest b72d811ed58c8f2ec01e110bcad3138b SHOW WARNINGS 1 +statements_digest 63e18c50006c39c70200e63e720a9f0a PREPARE stmt FROM ? 1 +statements_digest eac5a2c580910e14eb0894ef21a25353 EXECUTE stmt 2 +statements_digest 5f1eaa4567c93974669fc403159245db DEALLOCATE PREPARE stmt 1 +statements_digest acb8e84440f68ee053d486688dfc88b2 CREATE PROCEDURE p1 ( ) BEGIN SELECT * FROM t12 ; END 1 +statements_digest 44c11865a2c9cd9f884bca10564ac818 CALL p1 ( ) 2 +statements_digest fb004af2d0db6f35a97ccdbbc51343ef DROP PROCEDURE p1 1 +statements_digest 6566febd24d7b17c53f75785ce94936c CREATE FUNCTION `func` ( a INTEGER , b INTEGER ) RETURNS INTEGER (?) RETURN a + b 1 +statements_digest 5bc097b58c334afe0875d7b74d0eb86e SELECT func (...) 2 +statements_digest 183cce493d199f32fad2174aab485298 DROP FUNCTION func 1 +statements_digest b0f05e1bd191be18730e2e24801a448d CREATE TRIGGER trg BEFORE INSERT ON t12 FOR EACH ROW SET @ ? := ? 1 +statements_digest 4a20ca3773c57af8a3949b76f446505a INSERT INTO t12 VALUES (?) 2 +statements_digest b345f3bef14924fea5ce7129cd374576 DROP TRIGGER trg 1 SELECT digest, digest_text FROM performance_schema.events_statements_current; digest digest_text #################################### diff --git a/mysql-test/suite/perfschema/r/statement_digest_long_query.result b/mysql-test/suite/perfschema/r/statement_digest_long_query.result index f304b0108de..611bbef4434 100644 --- a/mysql-test/suite/perfschema/r/statement_digest_long_query.result +++ b/mysql-test/suite/perfschema/r/statement_digest_long_query.result @@ -8,5 +8,5 @@ SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1 #################################### SELECT schema_name, digest, digest_text, count_star FROM events_statements_summary_by_digest; schema_name digest digest_text count_star -performance_schema f7e1956f59eac75d9274653d492191ad TRUNCATE TABLE events_statements_summary_by_digest 1 -performance_schema aa750e240d5b31fa3ca6ef4375863e28 SELECT ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ... 1 +performance_schema 85f61b5db68f69a59a90190e8077e4af TRUNCATE TABLE events_statements_summary_by_digest 1 +performance_schema 0cc3fae5d60042494d108e9075b594d3 SELECT ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ... 1 diff --git a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result index a3a9316a7e7..b4af9d021ef 100644 --- a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result +++ b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result @@ -63,7 +63,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result index 2ce2450e2f8..6ccc81c5581 100644 --- a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result +++ b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result @@ -62,7 +62,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result index db2aa8e8a62..b7ed12e9f00 100644 --- a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result +++ b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result @@ -63,7 +63,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result index 3c047ab38eb..4f45ae0fedd 100644 --- a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result +++ b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result @@ -62,7 +62,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result index 433e1bf40e8..937a6bc11f4 100644 --- a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result +++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result @@ -61,7 +61,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result index 10f72b0f2bf..d6436c2f4ac 100644 --- a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result +++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result @@ -60,7 +60,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result index 210c2b503c9..fa805e36760 100644 --- a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result +++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result @@ -61,7 +61,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result index ab89f7c24ea..5b0105ab137 100644 --- a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result +++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result @@ -60,7 +60,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_aggregate_off.result b/mysql-test/suite/perfschema/r/table_aggregate_off.result index 57372963797..62d619854a8 100644 --- a/mysql-test/suite/perfschema/r/table_aggregate_off.result +++ b/mysql-test/suite/perfschema/r/table_aggregate_off.result @@ -62,7 +62,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result index f46eb5ba228..7c91487477c 100644 --- a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result +++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result @@ -63,7 +63,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result index a162949e54a..e4a3aabd51b 100644 --- a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result +++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result @@ -62,7 +62,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result index 083e8ed7341..f6d2ac4fb19 100644 --- a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result +++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result @@ -63,7 +63,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result index fccbaf0ad37..f76b83d2854 100644 --- a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result +++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result @@ -62,7 +62,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result index 989e521cd75..a5c6f669eb6 100644 --- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result +++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result @@ -65,7 +65,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result index 268e9cccd9e..a327eadeb75 100644 --- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result +++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result @@ -64,7 +64,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result index 5fedb1a93fb..2cd3cd51329 100644 --- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result +++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result @@ -65,7 +65,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result index f7f18bafb64..40eb000ea84 100644 --- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result +++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result @@ -64,7 +64,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result index e3a0bc98d8c..bc348ffdd1c 100644 --- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result +++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result @@ -63,7 +63,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result index ca3565b5350..5f30bde9421 100644 --- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result +++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result @@ -62,7 +62,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result index 65662f5974c..9a147466a78 100644 --- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result +++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result @@ -63,7 +63,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result index 6b7bfc07953..63b1f709b72 100644 --- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result +++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result @@ -62,7 +62,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result index 8ffd9f4e922..ac740035848 100644 --- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result +++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result @@ -65,7 +65,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result index 3de3432fbc4..8fa0ff230e3 100644 --- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result +++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result @@ -64,7 +64,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result index ec748384b8f..83d70261823 100644 --- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result +++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result @@ -65,7 +65,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result index 30b234f89be..5dac5f5b83a 100644 --- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result +++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result @@ -64,7 +64,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result index bda8c1587d8..f702ebadfc0 100644 --- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result +++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result @@ -65,7 +65,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result index f1be16ee937..693723f6538 100644 --- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result +++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result @@ -64,7 +64,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result index c0293a03175..274b9c22b9f 100644 --- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result +++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result @@ -65,7 +65,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result index 56317b28bf1..2cf43f9b47a 100644 --- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result +++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result @@ -64,7 +64,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result index 47b5f2757b9..412353b73dd 100644 --- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result +++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result @@ -63,7 +63,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result index e9febe20037..487bc91e784 100644 --- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result +++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result @@ -62,7 +62,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result index 677cb692f36..1fe09b3008f 100644 --- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result +++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result @@ -63,7 +63,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result index ea9d23307cc..5bbd3ca022c 100644 --- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result +++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result @@ -62,7 +62,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result index 45d463f28b1..4fd4f505454 100644 --- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result +++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result @@ -65,7 +65,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result index 17365d80f8a..a3e0129bb70 100644 --- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result +++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result @@ -64,7 +64,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result index c35dedb0871..3edba653026 100644 --- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result +++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result @@ -65,7 +65,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result index 5b02767819c..461ff5da3dd 100644 --- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result +++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result @@ -64,7 +64,7 @@ performance_schema_max_rwlock_instances 5000 performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_stage_classes 150 -performance_schema_max_statement_classes 175 +performance_schema_max_statement_classes 179 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 diff --git a/mysql-test/suite/roles/acl_load_mutex-5170.result b/mysql-test/suite/roles/acl_load_mutex-5170.result new file mode 100644 index 00000000000..6f6688f446e --- /dev/null +++ b/mysql-test/suite/roles/acl_load_mutex-5170.result @@ -0,0 +1,8 @@ +create user user1@localhost; +create role r1 with admin user1@localhost; +grant all on test.* to r1; +select 1; +1 +1 +drop role r1; +drop user user1@localhost; diff --git a/mysql-test/suite/roles/acl_load_mutex-5170.test b/mysql-test/suite/roles/acl_load_mutex-5170.test new file mode 100644 index 00000000000..e77d191ea16 --- /dev/null +++ b/mysql-test/suite/roles/acl_load_mutex-5170.test @@ -0,0 +1,24 @@ +--source include/not_embedded.inc +# +# MDEV-5170 Assertion `(&(&acl_cache->lock)->m_mutex)->count > 0 && pthread_equal(pthread_self(), (&(&acl_cache->lock)->m_mutex)->thread)' fails after restarting server with a pre-created role grants +# +create user user1@localhost; +create role r1 with admin user1@localhost; +grant all on test.* to r1; + +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +wait +EOF +--shutdown_server 60 +--source include/wait_until_disconnected.inc +--enable_reconnect +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +restart +EOF +--source include/wait_until_connected_again.inc + +select 1; + +drop role r1; +drop user user1@localhost; + diff --git a/mysql-test/suite/roles/admin.result b/mysql-test/suite/roles/admin.result new file mode 100644 index 00000000000..ad3d4125252 --- /dev/null +++ b/mysql-test/suite/roles/admin.result @@ -0,0 +1,152 @@ +grant create user on *.* to foo@localhost; +create role role1; +create role role2 with admin current_user; +create role role3 with admin current_role; +ERROR 0L000: Invalid definer +create role role3 with admin role1; +create role role4 with admin root@localhost; +create role role5 with admin root@localhost; +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation +create role role5 with admin role3; +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation +create role role5 with admin foo@localhost; +call mtr.add_suppression("Invalid roles_mapping table entry user:'foo@bar', rolename:'role6'"); +create role role6 with admin foo@bar; +Warnings: +Note 1449 The user specified as a definer ('foo'@'bar') does not exist +create user bar with admin current_user; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'admin current_user' at line 1 +grant role1 to foo@localhost with admin option; +grant role2 to foo@localhost; +grant role2 to role1; +grant role4 to role3 with admin option; +grant select on *.* to foo@localhost with admin option; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'admin option' at line 1 +show grants for foo@localhost; +Grants for foo@localhost +GRANT CREATE USER ON *.* TO 'foo'@'localhost' +GRANT role1 TO 'foo'@'localhost' WITH ADMIN OPTION +GRANT role2 TO 'foo'@'localhost' +GRANT role5 TO 'foo'@'localhost' WITH ADMIN OPTION +show grants for role1; +Grants for role1 +GRANT USAGE ON *.* TO 'role1' +GRANT USAGE ON *.* TO 'role2' +GRANT USAGE ON *.* TO 'role3' +GRANT USAGE ON *.* TO 'role4' +GRANT role2 TO 'role1' +GRANT role3 TO 'role1' WITH ADMIN OPTION +GRANT role4 TO 'role3' WITH ADMIN OPTION +show grants for role4; +Grants for role4 +GRANT USAGE ON *.* TO 'role4' +select * from mysql.roles_mapping; +Host User Role Admin_option + role1 role2 N + role1 role3 Y + role3 role4 Y +bar foo role6 Y +localhost foo role1 Y +localhost foo role2 N +localhost foo role5 Y +localhost root role1 Y +localhost root role2 Y +localhost root role4 Y +flush privileges; +show grants for foo@localhost; +Grants for foo@localhost +GRANT CREATE USER ON *.* TO 'foo'@'localhost' +GRANT role1 TO 'foo'@'localhost' WITH ADMIN OPTION +GRANT role2 TO 'foo'@'localhost' +GRANT role5 TO 'foo'@'localhost' WITH ADMIN OPTION +show grants for role1; +Grants for role1 +GRANT USAGE ON *.* TO 'role1' +GRANT USAGE ON *.* TO 'role2' +GRANT USAGE ON *.* TO 'role3' +GRANT USAGE ON *.* TO 'role4' +GRANT role2 TO 'role1' +GRANT role3 TO 'role1' WITH ADMIN OPTION +GRANT role4 TO 'role3' WITH ADMIN OPTION +show grants for role4; +Grants for role4 +GRANT USAGE ON *.* TO 'role4' +select * from information_schema.applicable_roles; +GRANTEE ROLE_NAME IS_GRANTABLE +role1 role2 NO +role1 role3 YES +role3 role4 YES +root@localhost role1 YES +root@localhost role2 YES +root@localhost role4 YES +grant role2 to role1 with admin option; +revoke role1 from foo@localhost; +revoke admin option for role4 from role3; +revoke admin option for role2 from foo@localhost; +revoke admin option for role1 from root@localhost; +show grants for foo@localhost; +Grants for foo@localhost +GRANT CREATE USER ON *.* TO 'foo'@'localhost' +GRANT role2 TO 'foo'@'localhost' +GRANT role5 TO 'foo'@'localhost' WITH ADMIN OPTION +show grants for role1; +Grants for role1 +GRANT USAGE ON *.* TO 'role1' +GRANT USAGE ON *.* TO 'role2' +GRANT USAGE ON *.* TO 'role3' +GRANT USAGE ON *.* TO 'role4' +GRANT role2 TO 'role1' WITH ADMIN OPTION +GRANT role3 TO 'role1' WITH ADMIN OPTION +GRANT role4 TO 'role3' +show grants for role4; +Grants for role4 +GRANT USAGE ON *.* TO 'role4' +select * from mysql.roles_mapping; +Host User Role Admin_option + role1 role2 Y + role1 role3 Y + role3 role4 N +bar foo role6 Y +localhost foo role2 N +localhost foo role5 Y +localhost root role1 N +localhost root role2 Y +localhost root role4 Y +flush privileges; +show grants for foo@localhost; +Grants for foo@localhost +GRANT CREATE USER ON *.* TO 'foo'@'localhost' +GRANT role2 TO 'foo'@'localhost' +GRANT role5 TO 'foo'@'localhost' WITH ADMIN OPTION +show grants for role1; +Grants for role1 +GRANT USAGE ON *.* TO 'role1' +GRANT USAGE ON *.* TO 'role2' +GRANT USAGE ON *.* TO 'role3' +GRANT USAGE ON *.* TO 'role4' +GRANT role2 TO 'role1' WITH ADMIN OPTION +GRANT role3 TO 'role1' WITH ADMIN OPTION +GRANT role4 TO 'role3' +show grants for role4; +Grants for role4 +GRANT USAGE ON *.* TO 'role4' +select * from information_schema.applicable_roles; +GRANTEE ROLE_NAME IS_GRANTABLE +role1 role2 YES +role1 role3 YES +role3 role4 NO +root@localhost role1 NO +root@localhost role2 YES +root@localhost role4 YES +grant role1 to role4; +ERROR 28000: Access denied for user 'root'@'localhost' +grant role1 to role4 with admin option; +ERROR 28000: Access denied for user 'root'@'localhost' +grant role3 to role2; +revoke role3 from role2; +grant role4 to role2 with admin option; +revoke role2 from current_user; +revoke role4 from current_user; +grant role4 to current_user; +drop role role1, role2, role3, role4, role5, role6; +drop user foo@localhost; diff --git a/mysql-test/suite/roles/admin.test b/mysql-test/suite/roles/admin.test new file mode 100644 index 00000000000..03f3449200b --- /dev/null +++ b/mysql-test/suite/roles/admin.test @@ -0,0 +1,102 @@ +source include/not_embedded.inc; + +grant create user on *.* to foo@localhost; + +######################################## +# syntax tests +######################################## + +create role role1; +create role role2 with admin current_user; +--error ER_MALFORMED_DEFINER +create role role3 with admin current_role; +create role role3 with admin role1; +create role role4 with admin root@localhost; + +# privilege checks, one needs SUPER to specify an arbitrary admin +connect (c1, localhost, foo,,); +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +create role role5 with admin root@localhost; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +create role role5 with admin role3; +create role role5 with admin foo@localhost; + +connection default; +# non-existing admin. works. warning. error in the log on acl_load. +call mtr.add_suppression("Invalid roles_mapping table entry user:'foo@bar', rolename:'role6'"); +create role role6 with admin foo@bar; + +--error ER_PARSE_ERROR +create user bar with admin current_user; + +grant role1 to foo@localhost with admin option; +grant role2 to foo@localhost; +grant role2 to role1; +grant role4 to role3 with admin option; +--error ER_PARSE_ERROR +grant select on *.* to foo@localhost with admin option; + +--sorted_result +show grants for foo@localhost; +--sorted_result +show grants for role1; +--sorted_result +show grants for role4; +--sorted_result +select * from mysql.roles_mapping; +flush privileges; +--sorted_result +show grants for foo@localhost; +--sorted_result +show grants for role1; +--sorted_result +show grants for role4; +--sorted_result +select * from information_schema.applicable_roles; + +grant role2 to role1 with admin option; +revoke role1 from foo@localhost; +revoke admin option for role4 from role3; +revoke admin option for role2 from foo@localhost; +revoke admin option for role1 from root@localhost; + +--sorted_result +show grants for foo@localhost; +--sorted_result +show grants for role1; +--sorted_result +show grants for role4; +--sorted_result +select * from mysql.roles_mapping; +flush privileges; +--sorted_result +show grants for foo@localhost; +--sorted_result +show grants for role1; +--sorted_result +show grants for role4; +--sorted_result +select * from information_schema.applicable_roles; + +# Now, root@localhost don't have admin option for role1: +--error ER_ACCESS_DENIED_NO_PASSWORD_ERROR +grant role1 to role4; +--error ER_ACCESS_DENIED_NO_PASSWORD_ERROR +grant role1 to role4 with admin option; +# but role3 is grantable +grant role3 to role2; +revoke role3 from role2; + +# now, a diamond +grant role4 to role2 with admin option; +revoke role2 from current_user; +revoke role4 from current_user; +grant role4 to current_user; + + +######################################## +# cleanup +######################################## +drop role role1, role2, role3, role4, role5, role6; +drop user foo@localhost; + diff --git a/mysql-test/suite/roles/create_and_drop_role.result b/mysql-test/suite/roles/create_and_drop_role.result new file mode 100644 index 00000000000..d4eac2756ec --- /dev/null +++ b/mysql-test/suite/roles/create_and_drop_role.result @@ -0,0 +1,36 @@ +use mysql; +create role test_role1@host1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '@host1' at line 1 +create role test_role2@host2, test_role1@host1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '@host2, test_role1@host1' at line 1 +create role test_role1; +create role test_role2, test_role3; +select user, host, is_role from user where user like 'test%'; +user host is_role +test_role1 Y +test_role2 Y +test_role3 Y +drop role test_role1; +drop role test_role2, test_role3; +create role test_role1; +create role test_role1; +ERROR HY000: Operation CREATE ROLE failed for 'test_role1' +create role test_role1, test_role2; +ERROR HY000: Operation CREATE ROLE failed for 'test_role1' +select user, host, is_role from user where user like 'test%'; +user host is_role +test_role1 Y +test_role2 Y +drop role test_role1; +drop role test_role1; +ERROR HY000: Operation DROP ROLE failed for 'test_role1' +drop role test_role1, test_role2; +ERROR HY000: Operation DROP ROLE failed for 'test_role1' +drop role root; +ERROR HY000: Operation DROP ROLE failed for 'root' +create user dummy@''; +drop role dummy; +ERROR HY000: Operation DROP ROLE failed for 'dummy' +drop user dummy@''; +select user, host, is_role from user where user like 'test%'; +user host is_role diff --git a/mysql-test/suite/roles/create_and_drop_role.test b/mysql-test/suite/roles/create_and_drop_role.test new file mode 100644 index 00000000000..3491986e666 --- /dev/null +++ b/mysql-test/suite/roles/create_and_drop_role.test @@ -0,0 +1,47 @@ +source include/not_embedded.inc; + +connect (mysql, localhost, root,,); +use mysql; + +#test valid syntax +--error ER_PARSE_ERROR +create role test_role1@host1; +--error ER_PARSE_ERROR +create role test_role2@host2, test_role1@host1; + +create role test_role1; +create role test_role2, test_role3; + +--sorted_result +select user, host, is_role from user where user like 'test%'; + +drop role test_role1; +drop role test_role2, test_role3; + + +create role test_role1; +--error ER_CANNOT_USER +create role test_role1; +--error ER_CANNOT_USER +create role test_role1, test_role2; + +--sorted_result +select user, host, is_role from user where user like 'test%'; + +drop role test_role1; +--error ER_CANNOT_USER +drop role test_role1; +--error ER_CANNOT_USER +drop role test_role1, test_role2; + +#test that we can not drop users when calling drop role +--error ER_CANNOT_USER +drop role root; +create user dummy@''; +--error ER_CANNOT_USER +drop role dummy; +drop user dummy@''; + +--sorted_result +select user, host, is_role from user where user like 'test%'; +disconnect mysql; diff --git a/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.result b/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.result new file mode 100644 index 00000000000..d0254fc2c44 --- /dev/null +++ b/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.result @@ -0,0 +1,14 @@ +use mysql; +alter table user drop column is_role; +flush privileges; +create role test_role; +ERROR HY000: Column count of mysql.user is wrong. Expected 44, found 43. Created with MariaDB 100004, now running 100004. Please use mysql_upgrade to fix this error. +drop role test_role; +ERROR HY000: Operation DROP ROLE failed for 'test_role' +alter table user add column is_role enum('N', 'Y') default 'N' not null +COLLATE utf8_general_ci +after password_expired; +update user set is_role='N'; +flush privileges; +create role test_role; +drop role test_role; diff --git a/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.test b/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.test new file mode 100644 index 00000000000..e83e2d3b278 --- /dev/null +++ b/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.test @@ -0,0 +1,25 @@ +source include/not_embedded.inc; + +connect (mysql, localhost, root,,); +use mysql; + +alter table user drop column is_role; + +flush privileges; + +--error ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE +create role test_role; +--error ER_CANNOT_USER +drop role test_role; +alter table user add column is_role enum('N', 'Y') default 'N' not null + COLLATE utf8_general_ci +after password_expired; + +update user set is_role='N'; + +flush privileges; +create role test_role; +drop role test_role; + + + diff --git a/mysql-test/suite/roles/create_and_grant_role.result b/mysql-test/suite/roles/create_and_grant_role.result new file mode 100644 index 00000000000..883ae44397d --- /dev/null +++ b/mysql-test/suite/roles/create_and_grant_role.result @@ -0,0 +1,26 @@ +create role r1; +grant r1 to root@localhost; +create user u1; +set role r1; +grant r1 to u1; +select * from mysql.roles_mapping; +Host User Role Admin_option +% u1 r1 N +localhost root r1 Y +drop user u1; +select * from mysql.roles_mapping; +Host User Role Admin_option +localhost root r1 Y +show grants; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION +GRANT USAGE ON *.* TO 'r1' +GRANT r1 TO 'root'@'localhost' WITH ADMIN OPTION +drop role r1; +select * from mysql.roles_mapping; +Host User Role Admin_option +show grants; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION diff --git a/mysql-test/suite/roles/create_and_grant_role.test b/mysql-test/suite/roles/create_and_grant_role.test new file mode 100644 index 00000000000..5b32150389e --- /dev/null +++ b/mysql-test/suite/roles/create_and_grant_role.test @@ -0,0 +1,21 @@ +source include/not_embedded.inc; + +create role r1; +grant r1 to root@localhost; +create user u1; +set role r1; + +grant r1 to u1; +--sorted_result +select * from mysql.roles_mapping; + +drop user u1; +--sorted_result +select * from mysql.roles_mapping; +--sorted_result +show grants; +drop role r1; +--sorted_result +select * from mysql.roles_mapping; +--sorted_result +show grants; diff --git a/mysql-test/suite/roles/default_create_user_not_role.result b/mysql-test/suite/roles/default_create_user_not_role.result new file mode 100644 index 00000000000..1ddb054c092 --- /dev/null +++ b/mysql-test/suite/roles/default_create_user_not_role.result @@ -0,0 +1,6 @@ +use mysql; +create user 'test'@'localhost'; +select user, host, is_role from user where user='test' and host='localhost'; +user host is_role +test localhost N +drop user 'test'@'localhost'; diff --git a/mysql-test/suite/roles/default_create_user_not_role.test b/mysql-test/suite/roles/default_create_user_not_role.test new file mode 100644 index 00000000000..d3a432892db --- /dev/null +++ b/mysql-test/suite/roles/default_create_user_not_role.test @@ -0,0 +1,11 @@ +source include/not_embedded.inc; + +connect (mysql, localhost, root,,); +use mysql; +create user 'test'@'localhost'; + +#check to see if a created user is not a role by default +select user, host, is_role from user where user='test' and host='localhost'; + +drop user 'test'@'localhost'; +disconnect mysql; diff --git a/mysql-test/suite/roles/definer.result b/mysql-test/suite/roles/definer.result new file mode 100644 index 00000000000..0010853be78 --- /dev/null +++ b/mysql-test/suite/roles/definer.result @@ -0,0 +1,625 @@ +create database mysqltest1; +use mysqltest1; +create table t1 (a int, b int, c int); +insert t1 values (1,10,100),(2,20,200); +create role role1; +grant select (a) on mysqltest1.t1 to role1; +grant event,execute,trigger on mysqltest1.* to role1; +grant role1 to current_user; +create role role2; +grant insert,select on mysqltest1.t1 to role2; +grant event,execute,trigger on mysqltest1.* to role2; +grant create view on mysqltest1.* to foo@localhost; +create role role4; +grant select on mysqltest1.t1 to role4; +grant role4 to foo@localhost; +create definer=current_role view test.v1 as select a+b,c from t1; +ERROR 0L000: Invalid definer +set role role1; +create definer=current_role view test.v1 as select a+b,c from t1; +show create view test.v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`role1` SQL SECURITY DEFINER VIEW `test`.`v1` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` latin1 latin1_swedish_ci +set role none; +create definer=role2 view test.v2 as select a+b,c from t1; +show create view test.v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`role2` SQL SECURITY DEFINER VIEW `test`.`v2` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` latin1 latin1_swedish_ci +create definer=role3 view test.v3 as select a+b,c from t1; +Warnings: +Note 1449 The user specified as a definer ('role3'@'%') does not exist +show create view test.v3; +View Create View character_set_client collation_connection +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`role3`@`%` SQL SECURITY DEFINER VIEW `test`.`v3` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` latin1 latin1_swedish_ci +Warnings: +Note 1449 The user specified as a definer ('role3'@'%') does not exist +show grants; +Grants for foo@localhost +GRANT role4 TO 'foo'@'localhost' +GRANT USAGE ON *.* TO 'foo'@'localhost' +GRANT CREATE VIEW ON `mysqltest1`.* TO 'foo'@'localhost' +select * from test.v1; +ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +select * from test.v2; +a+b c +11 100 +22 200 +select * from test.v3; +ERROR 28000: Access denied for user 'foo'@'localhost' (using password: NO) +create definer=role4 view test.v4 as select a+b,c from t1; +ERROR 42000: ANY command denied to user 'foo'@'localhost' for table 't1' +select * from t1; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1' +set role role4; +select * from t1; +a b c +1 10 100 +2 20 200 +create view test.v4 as select a+b,c from t1; +create definer=role4 view test.v5 as select a+b,c from t1; +select * from test.v4; +ERROR HY000: View 'test.v4' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +select * from test.v5; +a+b c +11 100 +22 200 +set role none; +select * from test.v4; +ERROR HY000: View 'test.v4' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +select * from test.v5; +a+b c +11 100 +22 200 +drop role role4; +show create view test.v5; +View Create View character_set_client collation_connection +v5 CREATE ALGORITHM=UNDEFINED DEFINER=`role4` SQL SECURITY DEFINER VIEW `test`.`v5` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` latin1 latin1_swedish_ci +Warnings: +Note 1449 The user specified as a definer ('role4'@'') does not exist +select * from test.v5; +ERROR HY000: The user specified as a definer ('role4'@'') does not exist +grant select on mysqltest1.t1 to role4; +show create view test.v5; +View Create View character_set_client collation_connection +v5 CREATE ALGORITHM=UNDEFINED DEFINER=`role4` SQL SECURITY DEFINER VIEW `test`.`v5` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` latin1 latin1_swedish_ci +Warnings: +Note 1449 The user specified as a definer ('role4'@'') does not exist +select * from test.v5; +ERROR HY000: The user specified as a definer ('role4'@'') does not exist +show create view test.v5; +View Create View character_set_client collation_connection +v5 CREATE ALGORITHM=UNDEFINED DEFINER=`role4`@`%` SQL SECURITY DEFINER VIEW `test`.`v5` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` latin1 latin1_swedish_ci +select * from test.v5; +a+b c +11 100 +22 200 +drop user role4; +create table t2 select * from t1; +create definer=current_role trigger tr1 before insert on t2 for each row +insert t1 values (111, 222, 333); +ERROR 0L000: Invalid definer +set role role1; +create definer=current_role trigger tr1 before insert on t2 for each row +insert t1 values (111, 222, 333); +show create trigger tr1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +tr1 CREATE DEFINER=`role1` trigger tr1 before insert on t2 for each row +insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci +set role none; +insert t2 values (11,22,33); +ERROR 42000: INSERT command denied to user 'role1'@'' for table 't1' +select * from t1; +a b c +1 10 100 +2 20 200 +select * from t2; +a b c +1 10 100 +2 20 200 +create definer=role2 trigger tr2 before delete on t2 for each row +insert t1 values (111, 222, 333); +show create trigger tr2; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +tr2 CREATE DEFINER=`role2` trigger tr2 before delete on t2 for each row +insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci +delete from t2 where a=1; +select * from t1; +a b c +1 10 100 +2 20 200 +111 222 333 +select * from t2; +a b c +2 20 200 +delete from t1 where a=111; +create definer=role3 trigger tr3 before update on t2 for each row +insert t1 values (111, 222, 333); +Warnings: +Note 1449 The user specified as a definer ('role3'@'%') does not exist +show create trigger tr3; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +tr3 CREATE DEFINER=`role3`@`%` trigger tr3 before update on t2 for each row +insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci +update t2 set b=2 where a=2; +ERROR HY000: The user specified as a definer ('role3'@'%') does not exist +select * from t1; +a b c +1 10 100 +2 20 200 +select * from t2; +a b c +2 20 200 +flush tables; +show create trigger tr2; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +tr2 CREATE DEFINER=`role2`@`` trigger tr2 before delete on t2 for each row +insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci +delete from t2 where a=2; +ERROR HY000: The user specified as a definer ('role2'@'%') does not exist +select * from t1; +a b c +1 10 100 +2 20 200 +select * from t2; +a b c +2 20 200 +create definer=current_role procedure pr1() insert t1 values (111, 222, 333); +ERROR 0L000: Invalid definer +set role role1; +create definer=current_role procedure pr1() insert t1 values (111, 222, 333); +show create procedure pr1; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +pr1 CREATE DEFINER=`role1` PROCEDURE `pr1`() +insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci +set role none; +call pr1(); +ERROR 42000: INSERT command denied to user 'role1'@'' for table 't1' +select * from t1; +a b c +1 10 100 +2 20 200 +create definer=role2 procedure pr2() insert t1 values (111, 222, 333); +show create procedure pr2; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +pr2 CREATE DEFINER=`role2` PROCEDURE `pr2`() +insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci +call pr2(); +select * from t1; +a b c +1 10 100 +2 20 200 +111 222 333 +delete from t1 where a=111; +create definer=role3 procedure pr3() insert t1 values (111, 222, 333); +Warnings: +Note 1449 The user specified as a definer ('role3'@'%') does not exist +show create procedure pr3; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +pr3 CREATE DEFINER=`role3`@`%` PROCEDURE `pr3`() +insert t1 values (111, 222, 333) latin1 latin1_swedish_ci latin1_swedish_ci +call pr3(); +ERROR HY000: The user specified as a definer ('role3'@'%') does not exist +select * from t1; +a b c +1 10 100 +2 20 200 +update mysql.proc set definer='role2@' where definer='role2'; +call pr2(); +ERROR HY000: The user specified as a definer ('role2'@'%') does not exist +create definer=current_role function fn1() returns int return (select sum(a+b) from t1); +ERROR 0L000: Invalid definer +set role role1; +create definer=current_role function fn1() returns int return (select sum(a+b) from t1); +show create function fn1; +Function sql_mode Create Function character_set_client collation_connection Database Collation +fn1 CREATE DEFINER=`role1` FUNCTION `fn1`() RETURNS int(11) +return (select sum(a+b) from t1) latin1 latin1_swedish_ci latin1_swedish_ci +set role none; +select fn1(); +ERROR 42000: SELECT command denied to user 'role1'@'' for column 'b' in table 't1' +select * from t1; +a b c +1 10 100 +2 20 200 +create definer=role2 function fn2() returns int return (select sum(a+b) from t1); +show create function fn2; +Function sql_mode Create Function character_set_client collation_connection Database Collation +fn2 CREATE DEFINER=`role2` FUNCTION `fn2`() RETURNS int(11) +return (select sum(a+b) from t1) latin1 latin1_swedish_ci latin1_swedish_ci +select fn2(); +fn2() +33 +create definer=role3 function fn3() returns int return (select sum(a+b) from t1); +Warnings: +Note 1449 The user specified as a definer ('role3'@'%') does not exist +show create function fn3; +Function sql_mode Create Function character_set_client collation_connection Database Collation +fn3 CREATE DEFINER=`role3`@`%` FUNCTION `fn3`() RETURNS int(11) +return (select sum(a+b) from t1) latin1 latin1_swedish_ci latin1_swedish_ci +select fn3(); +ERROR HY000: The user specified as a definer ('role3'@'%') does not exist +set global event_scheduler=on; +create definer=current_role event e1 on schedule every 1 second starts '2000-01-01' do +insert t1 values (111, 1, 0); +ERROR 0L000: Invalid definer +set role role1; +create definer=current_role event e1 on schedule every 1 second starts '2000-01-01' do +insert t1 values (111, 2, 0); +show create event e1; +Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation +e1 SYSTEM CREATE DEFINER=`role1` EVENT `e1` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 2, 0) latin1 latin1_swedish_ci latin1_swedish_ci +set role none; +create definer=role3 event e3 on schedule every 1 second starts '2000-01-01' do +insert t1 values (111, 3, 0); +Warnings: +Note 1449 The user specified as a definer ('role3'@'%') does not exist +show create event e3; +Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation +e3 SYSTEM CREATE DEFINER=`role3`@`%` EVENT `e3` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 3, 0) latin1 latin1_swedish_ci latin1_swedish_ci +create definer=role2 event e2 on schedule every 1 second starts '2000-01-01' do +insert t1 values (111, 4, 0); +show create event e2; +Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation +e2 SYSTEM CREATE DEFINER=`role2` EVENT `e2` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 4, 0) latin1 latin1_swedish_ci latin1_swedish_ci +set global event_scheduler=off; +select distinct * from t1; +a b c +1 10 100 +111 4 0 +2 20 200 +delete from t1 where a=111; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `test`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `v1` ( + `a+b` tinyint NOT NULL, + `c` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `v2` ( + `a+b` tinyint NOT NULL, + `c` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `v3` ( + `a+b` tinyint NOT NULL, + `c` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `v4` ( + `a+b` tinyint NOT NULL, + `c` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `v5` ( + `a+b` tinyint NOT NULL, + `c` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `mysqltest1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `t1` VALUES (1,10,100),(2,20,200); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `t2` VALUES (2,20,200); +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`role1`*/ /*!50003 trigger tr1 before insert on t2 for each row +insert t1 values (111, 222, 333) */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`role3`@`%`*/ /*!50003 trigger tr3 before update on t2 for each row +insert t1 values (111, 222, 333) */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`role2`@``*/ /*!50003 trigger tr2 before delete on t2 for each row +insert t1 values (111, 222, 333) */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50106 SET @save_time_zone= @@TIME_ZONE */ ; +DELIMITER ;; +/*!50003 SET @saved_cs_client = @@character_set_client */ ;; +/*!50003 SET @saved_cs_results = @@character_set_results */ ;; +/*!50003 SET @saved_col_connection = @@collation_connection */ ;; +/*!50003 SET character_set_client = latin1 */ ;; +/*!50003 SET character_set_results = latin1 */ ;; +/*!50003 SET collation_connection = latin1_swedish_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = '' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`role1`*/ /*!50106 EVENT `e1` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 2, 0) */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!50003 SET sql_mode = @saved_sql_mode */ ;; +/*!50003 SET character_set_client = @saved_cs_client */ ;; +/*!50003 SET character_set_results = @saved_cs_results */ ;; +/*!50003 SET collation_connection = @saved_col_connection */ ;; +DELIMITER ;; +/*!50003 SET @saved_cs_client = @@character_set_client */ ;; +/*!50003 SET @saved_cs_results = @@character_set_results */ ;; +/*!50003 SET @saved_col_connection = @@collation_connection */ ;; +/*!50003 SET character_set_client = latin1 */ ;; +/*!50003 SET character_set_results = latin1 */ ;; +/*!50003 SET collation_connection = latin1_swedish_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = '' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`role2`*/ /*!50106 EVENT `e2` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 4, 0) */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!50003 SET sql_mode = @saved_sql_mode */ ;; +/*!50003 SET character_set_client = @saved_cs_client */ ;; +/*!50003 SET character_set_results = @saved_cs_results */ ;; +/*!50003 SET collation_connection = @saved_col_connection */ ;; +DELIMITER ;; +/*!50003 SET @saved_cs_client = @@character_set_client */ ;; +/*!50003 SET @saved_cs_results = @@character_set_results */ ;; +/*!50003 SET @saved_col_connection = @@collation_connection */ ;; +/*!50003 SET character_set_client = latin1 */ ;; +/*!50003 SET character_set_results = latin1 */ ;; +/*!50003 SET collation_connection = latin1_swedish_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = '' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`role3`@`%`*/ /*!50106 EVENT `e3` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 3, 0) */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!50003 SET sql_mode = @saved_sql_mode */ ;; +/*!50003 SET character_set_client = @saved_cs_client */ ;; +/*!50003 SET character_set_results = @saved_cs_results */ ;; +/*!50003 SET collation_connection = @saved_col_connection */ ;; +DELIMITER ; +/*!50106 SET TIME_ZONE= @save_time_zone */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +CREATE DEFINER=`role1` FUNCTION `fn1`() RETURNS int(11) +return (select sum(a+b) from t1) ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +CREATE DEFINER=`role2` FUNCTION `fn2`() RETURNS int(11) +return (select sum(a+b) from t1) ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +CREATE DEFINER=`role3`@`%` FUNCTION `fn3`() RETURNS int(11) +return (select sum(a+b) from t1) ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +CREATE DEFINER=`role1` PROCEDURE `pr1`() +insert t1 values (111, 222, 333) ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +CREATE DEFINER=`role2`@`%` PROCEDURE `pr2`() +insert t1 values (111, 222, 333) ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +CREATE DEFINER=`role3`@`%` PROCEDURE `pr3`() +insert t1 values (111, 222, 333) ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +USE `test`; +/*!50001 DROP TABLE IF EXISTS `v1`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`role1` SQL SECURITY DEFINER VIEW `v1` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!50001 DROP TABLE IF EXISTS `v2`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`role2` SQL SECURITY DEFINER VIEW `v2` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!50001 DROP TABLE IF EXISTS `v3`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`role3`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v3` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!50001 DROP TABLE IF EXISTS `v4`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`foo`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v4` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!50001 DROP TABLE IF EXISTS `v5`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`role4`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v5` AS select (`mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b`) AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +USE `mysqltest1`; +drop trigger tr1; +drop trigger tr2; +drop trigger tr3; +drop procedure pr1; +drop procedure pr2; +drop procedure pr3; +drop function fn1; +drop function fn2; +drop function fn3; +drop event e1; +drop event e2; +drop event e3; +drop view test.v1, test.v2, test.v3, test.v4, test.v5; +drop table t1, t2; +drop role role1, role2; +drop user foo@localhost; +drop database mysqltest1; +use test; +create user utest; +prepare stmt1 from 'grant select on *.* to utest'; +execute stmt1; +show grants for utest; +Grants for utest@% +GRANT SELECT ON *.* TO 'utest'@'%' +drop user utest; +create role utest; +execute stmt1; +show grants for utest; +Grants for utest +GRANT SELECT ON *.* TO 'utest' +drop role utest; diff --git a/mysql-test/suite/roles/definer.test b/mysql-test/suite/roles/definer.test new file mode 100644 index 00000000000..3c069105c8c --- /dev/null +++ b/mysql-test/suite/roles/definer.test @@ -0,0 +1,331 @@ +# create view +# create trigger +# create procedure +# create event +# mysqldump dumping the definer + +source include/not_embedded.inc; +let MYSQLD_DATADIR=`select @@datadir`; + +create database mysqltest1; +use mysqltest1; + +create table t1 (a int, b int, c int); +insert t1 values (1,10,100),(2,20,200); + +# non-priv role granted +create role role1; +grant select (a) on mysqltest1.t1 to role1; +grant event,execute,trigger on mysqltest1.* to role1; + +grant role1 to current_user; + +# priv role +create role role2; +grant insert,select on mysqltest1.t1 to role2; +grant event,execute,trigger on mysqltest1.* to role2; + +# create a non-priv user and a priv role granted to him +grant create view on mysqltest1.* to foo@localhost; +create role role4; +grant select on mysqltest1.t1 to role4; +grant role4 to foo@localhost; + +################################################## +# views +################################################## + +# no curent role = error +--error ER_MALFORMED_DEFINER +create definer=current_role view test.v1 as select a+b,c from t1; + +# definer=current_role, but it has doesn't have enough privileges +set role role1; +create definer=current_role view test.v1 as select a+b,c from t1; +show create view test.v1; +set role none; + +# definer=role_name, privileges ok +create definer=role2 view test.v2 as select a+b,c from t1; +show create view test.v2; + +# definer=non_existent_role +create definer=role3 view test.v3 as select a+b,c from t1; +show create view test.v3; + +connect (c1, localhost, foo,,mysqltest1); +connection c1; +show grants; + +# role1 doesn't have enough privileges for v1 to work +--error ER_VIEW_INVALID +select * from test.v1; + +# role2 is ok, v2 is ok +select * from test.v2; + +# role3 is treated as a user name role3@%, doesn't exist, v3 fails +--error ER_ACCESS_DENIED_ERROR +select * from test.v3; + +# fails, no SUPER - cannot specify a definer arbitrarily +--error ER_TABLEACCESS_DENIED_ERROR +create definer=role4 view test.v4 as select a+b,c from t1; + +--error ER_TABLEACCESS_DENIED_ERROR +select * from t1; +set role role4; +select * from t1; + +# can select from t1, but the view won't work, by default definer=current_user +create view test.v4 as select a+b,c from t1; + +# now role4 is the current_role, can be specified as a definer +create definer=role4 view test.v5 as select a+b,c from t1; + +--error ER_VIEW_INVALID +select * from test.v4; +select * from test.v5; +set role none; +--error ER_VIEW_INVALID +select * from test.v4; +select * from test.v5; + +connection default; + +drop role role4; + +show create view test.v5; +--error ER_NO_SUCH_USER +select * from test.v5; + +grant select on mysqltest1.t1 to role4; +show create view test.v5; +--error ER_NO_SUCH_USER +select * from test.v5; + +# pretend it's an old view from before 10.0.5 +perl; +local $/; +my $f= "$ENV{MYSQLD_DATADIR}/test/v5.frm"; +open(F, '<', $f) or die "open(<$f): $!"; +$_=<F>; +s/create-version=2/create-version=1/; +open(F, '>', $f) or die "open(>$f): $!"; +syswrite F, $_ or die "syswrite($f): $!" +EOF + +show create view test.v5; +select * from test.v5; +drop user role4; + + +################################################## +# trigger +################################################## + +create table t2 select * from t1; + +# no curent role = error +--error ER_MALFORMED_DEFINER +create definer=current_role trigger tr1 before insert on t2 for each row + insert t1 values (111, 222, 333); + +# definer=current_role, but it has doesn't have enough privileges +set role role1; +create definer=current_role trigger tr1 before insert on t2 for each row + insert t1 values (111, 222, 333); +show create trigger tr1; +set role none; + +--error ER_TABLEACCESS_DENIED_ERROR +insert t2 values (11,22,33); +select * from t1; +select * from t2; + +# definer=role_name, privileges ok +create definer=role2 trigger tr2 before delete on t2 for each row + insert t1 values (111, 222, 333); +show create trigger tr2; +delete from t2 where a=1; +select * from t1; +select * from t2; +delete from t1 where a=111; + +# definer=non_existent_role +create definer=role3 trigger tr3 before update on t2 for each row + insert t1 values (111, 222, 333); +show create trigger tr3; +--error ER_NO_SUCH_USER +update t2 set b=2 where a=2; +select * from t1; +select * from t2; + +flush tables; + +# change triggers to use pre-10.0.5 definer with an empty hostname +perl; +local $/; +my $f= "$ENV{MYSQLD_DATADIR}/mysqltest1/t2.TRG"; +open(F, '<', $f) or die "open(<$f): $!"; +$_=<F>; +s/'role2'/'role2\@'/; +s/`role2`/$&\@``/; +open(F, '>', $f) or die "open(>$f): $!"; +syswrite F, $_ or die "syswrite($f): $!" +EOF + +show create trigger tr2; +--error ER_NO_SUCH_USER +delete from t2 where a=2; +select * from t1; +select * from t2; + +################################################## +# stored procedures +################################################## + +# no curent role = error +--error ER_MALFORMED_DEFINER +create definer=current_role procedure pr1() insert t1 values (111, 222, 333); + +# definer=current_role, but it has doesn't have enough privileges +set role role1; +create definer=current_role procedure pr1() insert t1 values (111, 222, 333); +show create procedure pr1; +set role none; + +--error ER_TABLEACCESS_DENIED_ERROR +call pr1(); +select * from t1; + +# definer=role_name, privileges ok +create definer=role2 procedure pr2() insert t1 values (111, 222, 333); +show create procedure pr2; +call pr2(); +select * from t1; +delete from t1 where a=111; + +# definer=non_existent_role +create definer=role3 procedure pr3() insert t1 values (111, 222, 333); +show create procedure pr3; +--error ER_NO_SUCH_USER +call pr3(); +select * from t1; + +# change a procedure to use pre-10.0.5 definer with an empty hostname +update mysql.proc set definer='role2@' where definer='role2'; +--error ER_NO_SUCH_USER +call pr2(); + +################################################## +# stored functions +################################################## + +# no curent role = error +--error ER_MALFORMED_DEFINER +create definer=current_role function fn1() returns int return (select sum(a+b) from t1); + +# definer=current_role, but it has doesn't have enough privileges +set role role1; +create definer=current_role function fn1() returns int return (select sum(a+b) from t1); +show create function fn1; +set role none; + +--error ER_COLUMNACCESS_DENIED_ERROR +select fn1(); +select * from t1; + +# definer=role_name, privileges ok +create definer=role2 function fn2() returns int return (select sum(a+b) from t1); +show create function fn2; +select fn2(); + +# definer=non_existent_role +create definer=role3 function fn3() returns int return (select sum(a+b) from t1); +show create function fn3; +--error ER_NO_SUCH_USER +select fn3(); + +################################################## +# events +################################################## + +set global event_scheduler=on; + +# no curent role = error +--error ER_MALFORMED_DEFINER +create definer=current_role event e1 on schedule every 1 second starts '2000-01-01' do + insert t1 values (111, 1, 0); + +# definer=current_role, but it has doesn't have enough privileges +set role role1; +create definer=current_role event e1 on schedule every 1 second starts '2000-01-01' do + insert t1 values (111, 2, 0); +show create event e1; +set role none; + +# definer=non_existent_role +create definer=role3 event e3 on schedule every 1 second starts '2000-01-01' do + insert t1 values (111, 3, 0); +show create event e3; + +# definer=role_name, privileges ok +create definer=role2 event e2 on schedule every 1 second starts '2000-01-01' do + insert t1 values (111, 4, 0); +show create event e2; + +let $wait_condition=select count(*) >= 4 from t1; +--source include/wait_condition.inc + +set global event_scheduler=off; + +--sorted_result +select distinct * from t1; +delete from t1 where a=111; + +################################################## +# mysqldump +################################################## + +# note that LOCK TABLES won't work because v3 has invalid definer + +--exec $MYSQL_DUMP --compact --events --routines --skip-lock-tables --databases test mysqltest1 + +################################################## +# cleanup +################################################## + +drop trigger tr1; +drop trigger tr2; +drop trigger tr3; +drop procedure pr1; +drop procedure pr2; +drop procedure pr3; +drop function fn1; +drop function fn2; +drop function fn3; +drop event e1; +drop event e2; +drop event e3; +drop view test.v1, test.v2, test.v3, test.v4, test.v5; +drop table t1, t2; +drop role role1, role2; +drop user foo@localhost; +drop database mysqltest1; +use test; + +################################################## +# reexecution +################################################## + +create user utest; +prepare stmt1 from 'grant select on *.* to utest'; +execute stmt1; +show grants for utest; +drop user utest; +create role utest; +execute stmt1; +show grants for utest; +drop role utest; + diff --git a/mysql-test/suite/roles/drop_current_user-5176.result b/mysql-test/suite/roles/drop_current_user-5176.result new file mode 100644 index 00000000000..8e01bb10bd5 --- /dev/null +++ b/mysql-test/suite/roles/drop_current_user-5176.result @@ -0,0 +1,9 @@ +grant create user on *.* to foo@localhost; +drop user foo@localhost; +select * from information_schema.applicable_roles; +GRANTEE ROLE_NAME IS_GRANTABLE +show grants; +ERROR 42000: There is no such grant defined for user 'foo' on host 'localhost' +select current_user(); +current_user() +foo@localhost diff --git a/mysql-test/suite/roles/drop_current_user-5176.test b/mysql-test/suite/roles/drop_current_user-5176.test new file mode 100644 index 00000000000..e022d3e8a86 --- /dev/null +++ b/mysql-test/suite/roles/drop_current_user-5176.test @@ -0,0 +1,13 @@ +# +# MDEV-5176 Server crashes in fill_schema_applicable_roles on select from APPLICABLE_ROLES after a suicide +# +--source include/not_embedded.inc + +grant create user on *.* to foo@localhost; +--connect (foo,localhost,foo,,) +drop user foo@localhost; +select * from information_schema.applicable_roles; +--error ER_NONEXISTING_GRANT +show grants; +select current_user(); + diff --git a/mysql-test/suite/roles/drop_routines.result b/mysql-test/suite/roles/drop_routines.result new file mode 100644 index 00000000000..ad2a82c37c5 --- /dev/null +++ b/mysql-test/suite/roles/drop_routines.result @@ -0,0 +1,79 @@ +create role r1; +create role r2; +create role r3; +create user u1; +grant r2 to r1; +grant r3 to r2; +grant r1 to u1; +show grants for u1; +Grants for u1@% +GRANT USAGE ON *.* TO 'u1'@'%' +GRANT r1 TO 'u1'@'%' +show grants for r1; +Grants for r1 +GRANT USAGE ON *.* TO 'r1' +GRANT USAGE ON *.* TO 'r2' +GRANT USAGE ON *.* TO 'r3' +GRANT r2 TO 'r1' +GRANT r3 TO 'r2' +grant SELECT on *.* to u1; +grant INSERT on mysql.* to r1; +grant DELETE on mysql.roles_mapping to r2; +grant UPDATE on mysql.user to r3; +create function mysql.test_func (s CHAR(20)) +returns CHAR(50) DETERMINISTIC +return concat('Test string: ',s); +create procedure mysql.test_proc (OUT param1 INT) +begin +select COUNT(*) into param1 from mysql.roles_mapping; +end| +grant execute on function mysql.test_func to r2; +grant execute on procedure mysql.test_proc to r3; +revoke execute on procedure mysql.test_proc from r2; +ERROR 42000: There is no such grant defined for user 'r2' on host '' on routine 'test_proc' +show grants for r1; +Grants for r1 +GRANT DELETE ON `mysql`.`roles_mapping` TO 'r2' +GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO 'r2' +GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO 'r3' +GRANT INSERT ON `mysql`.* TO 'r1' +GRANT UPDATE ON `mysql`.`user` TO 'r3' +GRANT USAGE ON *.* TO 'r1' +GRANT USAGE ON *.* TO 'r2' +GRANT USAGE ON *.* TO 'r3' +GRANT r2 TO 'r1' +GRANT r3 TO 'r2' +show grants for r2; +Grants for r2 +GRANT DELETE ON `mysql`.`roles_mapping` TO 'r2' +GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO 'r2' +GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO 'r3' +GRANT UPDATE ON `mysql`.`user` TO 'r3' +GRANT USAGE ON *.* TO 'r2' +GRANT USAGE ON *.* TO 'r3' +GRANT r3 TO 'r2' +show grants for r3; +Grants for r3 +GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO 'r3' +GRANT UPDATE ON `mysql`.`user` TO 'r3' +GRANT USAGE ON *.* TO 'r3' +drop function mysql.test_func; +drop procedure mysql.test_proc; +create function mysql.test_func (s CHAR(20)) +returns CHAR(50) DETERMINISTIC +return concat('Test string: ',s); +show grants for r2; +Grants for r2 +GRANT DELETE ON `mysql`.`roles_mapping` TO 'r2' +GRANT UPDATE ON `mysql`.`user` TO 'r3' +GRANT USAGE ON *.* TO 'r2' +GRANT USAGE ON *.* TO 'r3' +GRANT r3 TO 'r2' +select mysql.test_func("none"); +ERROR 42000: execute command denied to user 'u1'@'%' for routine 'mysql.test_func' +set role r1; +select mysql.test_func("r1"); +ERROR 42000: execute command denied to user 'u1'@'%' for routine 'mysql.test_func' +drop function mysql.test_func; +drop role r1, r2, r3; +drop user u1; diff --git a/mysql-test/suite/roles/drop_routines.test b/mysql-test/suite/roles/drop_routines.test new file mode 100644 index 00000000000..b5972d8d9f9 --- /dev/null +++ b/mysql-test/suite/roles/drop_routines.test @@ -0,0 +1,69 @@ +source include/not_embedded.inc; + +create role r1; +create role r2; +create role r3; +create user u1; + +#CREATE A CHAIN OF ROLES +grant r2 to r1; +grant r3 to r2; +grant r1 to u1; + +--sorted_result +show grants for u1; +--sorted_result +show grants for r1; + +grant SELECT on *.* to u1; +grant INSERT on mysql.* to r1; +grant DELETE on mysql.roles_mapping to r2; +grant UPDATE on mysql.user to r3; + +create function mysql.test_func (s CHAR(20)) +returns CHAR(50) DETERMINISTIC +return concat('Test string: ',s); + +delimiter |; +create procedure mysql.test_proc (OUT param1 INT) +begin + select COUNT(*) into param1 from mysql.roles_mapping; +end| +delimiter ;| + +grant execute on function mysql.test_func to r2; +grant execute on procedure mysql.test_proc to r3; + +--error ER_NONEXISTING_PROC_GRANT +revoke execute on procedure mysql.test_proc from r2; + +--sorted_result +show grants for r1; +--sorted_result +show grants for r2; +--sorted_result +show grants for r3; + +drop function mysql.test_func; +drop procedure mysql.test_proc; + +create function mysql.test_func (s CHAR(20)) +returns CHAR(50) DETERMINISTIC +return concat('Test string: ',s); + +--sorted_result +show grants for r2; + +--connect (u1,localhost,u1,,) + +--error ER_PROCACCESS_DENIED_ERROR +select mysql.test_func("none"); +set role r1; +--error ER_PROCACCESS_DENIED_ERROR +select mysql.test_func("r1"); + +connection default; + +drop function mysql.test_func; +drop role r1, r2, r3; +drop user u1; diff --git a/mysql-test/suite/roles/none_public.result b/mysql-test/suite/roles/none_public.result new file mode 100644 index 00000000000..8b92e5bfcfc --- /dev/null +++ b/mysql-test/suite/roles/none_public.result @@ -0,0 +1,56 @@ +create role role1; +create role none; +ERROR OP000: Invalid role specification `none`. +create role public; +ERROR OP000: Invalid role specification `public`. +drop role none; +ERROR HY000: Operation DROP ROLE failed for 'none' +grant none to role1; +ERROR OP000: Invalid role specification `none`. +grant role1 to none; +ERROR OP000: Invalid role specification `none`. +grant select on *.* to none; +ERROR OP000: Invalid role specification `none`. +grant public to role1; +ERROR OP000: Invalid role specification `public`. +grant role1 to public; +ERROR OP000: Invalid role specification `public`. +grant select on *.* to public; +ERROR OP000: Invalid role specification `public`. +grant role1 to current_role; +ERROR OP000: Invalid role specification `NONE`. +revoke none from role1; +ERROR OP000: Invalid role specification `none`. +revoke role1 from none; +ERROR OP000: Invalid role specification `none`. +revoke select on *.* from none; +ERROR OP000: Invalid role specification `none`. +revoke public from role1; +ERROR OP000: Invalid role specification `public`. +revoke role1 from public; +ERROR OP000: Invalid role specification `public`. +revoke select on *.* from public; +ERROR OP000: Invalid role specification `public`. +show grants for none; +ERROR OP000: Invalid role specification `none`. +show grants for public; +ERROR OP000: Invalid role specification `public`. +create definer=none view test.v1 as select 1; +ERROR OP000: Invalid role specification `none`. +create definer=public view test.v1 as select 1; +ERROR OP000: Invalid role specification `public`. +drop role role1; +optimize table mysql.user; +Table Op Msg_type Msg_text +mysql.user optimize status OK +insert mysql.user (user, is_role) values ('none', 'Y'), ('public', 'Y'); +Warnings: +Warning 1364 Field 'ssl_cipher' doesn't have a default value +Warning 1364 Field 'x509_issuer' doesn't have a default value +Warning 1364 Field 'x509_subject' doesn't have a default value +Warning 1364 Field 'authentication_string' doesn't have a default value +flush privileges; +Warnings: +Error 1959 Invalid role specification `none`. +Error 1959 Invalid role specification `public`. +delete from mysql.user where is_role='Y'; diff --git a/mysql-test/suite/roles/none_public.test b/mysql-test/suite/roles/none_public.test new file mode 100644 index 00000000000..8e370d80007 --- /dev/null +++ b/mysql-test/suite/roles/none_public.test @@ -0,0 +1,57 @@ +source include/not_embedded.inc; + +create role role1; + +--error ER_INVALID_ROLE +create role none; +--error ER_INVALID_ROLE +create role public; +--error ER_CANNOT_USER +drop role none; + +--error ER_INVALID_ROLE +grant none to role1; +--error ER_INVALID_ROLE +grant role1 to none; +--error ER_INVALID_ROLE +grant select on *.* to none; +--error ER_INVALID_ROLE +grant public to role1; +--error ER_INVALID_ROLE +grant role1 to public; +--error ER_INVALID_ROLE +grant select on *.* to public; + +--error ER_INVALID_ROLE +grant role1 to current_role; + +--error ER_INVALID_ROLE +revoke none from role1; +--error ER_INVALID_ROLE +revoke role1 from none; +--error ER_INVALID_ROLE +revoke select on *.* from none; +--error ER_INVALID_ROLE +revoke public from role1; +--error ER_INVALID_ROLE +revoke role1 from public; +--error ER_INVALID_ROLE +revoke select on *.* from public; + +--error ER_INVALID_ROLE +show grants for none; +--error ER_INVALID_ROLE +show grants for public; + +--error ER_INVALID_ROLE +create definer=none view test.v1 as select 1; +--error ER_INVALID_ROLE +create definer=public view test.v1 as select 1; + +drop role role1; + +optimize table mysql.user; # to remove deleted rows and have stable row order +insert mysql.user (user, is_role) values ('none', 'Y'), ('public', 'Y'); +flush privileges; +delete from mysql.user where is_role='Y'; + diff --git a/mysql-test/suite/roles/password.result b/mysql-test/suite/roles/password.result new file mode 100644 index 00000000000..e41816bdef7 --- /dev/null +++ b/mysql-test/suite/roles/password.result @@ -0,0 +1,34 @@ +create role r1; +grant select on *.* to r1 identified by 'foobar'; +ERROR 28000: Can't find any matching row in the user table +grant select on *.* to r1 identified by ''; +ERROR 28000: Can't find any matching row in the user table +grant select on mysql.user to r1 identified by password '00000000000000000000000000000000000000000'; +ERROR 28000: Can't find any matching row in the user table +grant select on *.* to r1 identified via plugin; +ERROR 28000: Can't find any matching row in the user table +grant select on mysql.user to r1 identified via plugin using 'param'; +ERROR 28000: Can't find any matching row in the user table +grant select on *.* to r1 require subject 'foobar'; +ERROR 28000: Can't find any matching row in the user table +grant select on mysql.user to r1 require issuer 'foobar'; +ERROR 28000: Can't find any matching row in the user table +grant select on *.* to r1 require cipher 'foobar'; +ERROR 28000: Can't find any matching row in the user table +grant select on mysql.user to r1 require ssl; +ERROR 28000: Can't find any matching row in the user table +grant select on *.* to r1 require x509; +ERROR 28000: Can't find any matching row in the user table +grant select on mysql.user to r1 require none; +ERROR 28000: Can't find any matching row in the user table +grant select on *.* to r1 with max_queries_per_hour 10; +ERROR 28000: Can't find any matching row in the user table +grant select on mysql.user to r1 with max_updates_per_hour 10; +ERROR 28000: Can't find any matching row in the user table +grant select on *.* to r1 with max_connections_per_hour 10; +ERROR 28000: Can't find any matching row in the user table +grant select on mysql.user to r1 with max_user_connections 10; +ERROR 28000: Can't find any matching row in the user table +set password for r1 = '00000000000000000000000000000000000000000'; +ERROR 28000: Can't find any matching row in the user table +drop role r1; diff --git a/mysql-test/suite/roles/password.test b/mysql-test/suite/roles/password.test new file mode 100644 index 00000000000..6b5073fae43 --- /dev/null +++ b/mysql-test/suite/roles/password.test @@ -0,0 +1,48 @@ +# +# setting authentication for roles +# + +--source include/not_embedded.inc + +#identified by [password]... +#identified with ... [using ...] +#require [subject][issuer][cipher][ssl][x509] +# max_queries_per_hour | max_updates_per_hour | max_connections_per_hour | max_user_connections +#set password for ... = ... + +create role r1; + +--error ER_PASSWORD_NO_MATCH +grant select on *.* to r1 identified by 'foobar'; +--error ER_PASSWORD_NO_MATCH +grant select on *.* to r1 identified by ''; +--error ER_PASSWORD_NO_MATCH +grant select on mysql.user to r1 identified by password '00000000000000000000000000000000000000000'; +--error ER_PASSWORD_NO_MATCH +grant select on *.* to r1 identified via plugin; +--error ER_PASSWORD_NO_MATCH +grant select on mysql.user to r1 identified via plugin using 'param'; +--error ER_PASSWORD_NO_MATCH +grant select on *.* to r1 require subject 'foobar'; +--error ER_PASSWORD_NO_MATCH +grant select on mysql.user to r1 require issuer 'foobar'; +--error ER_PASSWORD_NO_MATCH +grant select on *.* to r1 require cipher 'foobar'; +--error ER_PASSWORD_NO_MATCH +grant select on mysql.user to r1 require ssl; +--error ER_PASSWORD_NO_MATCH +grant select on *.* to r1 require x509; +--error ER_PASSWORD_NO_MATCH +grant select on mysql.user to r1 require none; +--error ER_PASSWORD_NO_MATCH +grant select on *.* to r1 with max_queries_per_hour 10; +--error ER_PASSWORD_NO_MATCH +grant select on mysql.user to r1 with max_updates_per_hour 10; +--error ER_PASSWORD_NO_MATCH +grant select on *.* to r1 with max_connections_per_hour 10; +--error ER_PASSWORD_NO_MATCH +grant select on mysql.user to r1 with max_user_connections 10; +--error ER_PASSWORD_NO_MATCH +set password for r1 = '00000000000000000000000000000000000000000'; + +drop role r1; diff --git a/mysql-test/suite/roles/rebuild_role_grants.result b/mysql-test/suite/roles/rebuild_role_grants.result new file mode 100644 index 00000000000..2817c046ae9 --- /dev/null +++ b/mysql-test/suite/roles/rebuild_role_grants.result @@ -0,0 +1,58 @@ +create role r1; +create user u1; +grant r1 to u1; +show grants for u1; +Grants for u1@% +GRANT USAGE ON *.* TO 'u1'@'%' +GRANT r1 TO 'u1'@'%' +create user u2; +show grants for u1; +Grants for u1@% +GRANT USAGE ON *.* TO 'u1'@'%' +GRANT r1 TO 'u1'@'%' +show grants for u2; +Grants for u2@% +GRANT USAGE ON *.* TO 'u2'@'%' +select * from mysql.roles_mapping; +Host User Role Admin_option +% u1 r1 N +localhost root r1 Y +revoke r1 from u1; +revoke r1 from u1; +ERROR HY000: Cannot revoke role 'r1' from: 'u1'@'%'. +show grants for u1; +Grants for u1@% +GRANT USAGE ON *.* TO 'u1'@'%' +select * from mysql.roles_mapping; +Host User Role Admin_option +localhost root r1 Y +grant r1 to u1; +grant r1 to u1; +show grants for u1; +Grants for u1@% +GRANT USAGE ON *.* TO 'u1'@'%' +GRANT r1 TO 'u1'@'%' +select * from mysql.roles_mapping; +Host User Role Admin_option +% u1 r1 N +localhost root r1 Y +drop role r1; +show grants for u1; +Grants for u1@% +GRANT USAGE ON *.* TO 'u1'@'%' +select * from mysql.roles_mapping; +Host User Role Admin_option +create role r1; +grant r1 to u1; +select * from mysql.roles_mapping; +Host User Role Admin_option +% u1 r1 N +localhost root r1 Y +drop user u1; +show grants for u1; +ERROR 42000: There is no such grant defined for user 'u1' on host '%' +select * from mysql.roles_mapping; +Host User Role Admin_option +localhost root r1 Y +drop role r1; +drop user u2; diff --git a/mysql-test/suite/roles/rebuild_role_grants.test b/mysql-test/suite/roles/rebuild_role_grants.test new file mode 100644 index 00000000000..3ec3577317a --- /dev/null +++ b/mysql-test/suite/roles/rebuild_role_grants.test @@ -0,0 +1,56 @@ +source include/not_embedded.inc; + +create role r1; +create user u1; +grant r1 to u1; + +#CHECK IF GRANTS ARE UPDATED ON GRANT +--sorted_result +show grants for u1; + +create user u2; + +#CHECK THAT GRANTS ARE UPDATED ON ACL_USERS CHANGE +--sorted_result +show grants for u1; +--sorted_result +show grants for u2; +--sorted_result +select * from mysql.roles_mapping; + +revoke r1 from u1; +#TEST ERROR MESSAGE +--error ER_CANNOT_REVOKE_ROLE +revoke r1 from u1; +--sorted_result +show grants for u1; +--sorted_result +select * from mysql.roles_mapping; + +# granting twice is ok +grant r1 to u1; +grant r1 to u1; +--sorted_result +show grants for u1; +--sorted_result +select * from mysql.roles_mapping; + +drop role r1; +--sorted_result +show grants for u1; +--sorted_result +select * from mysql.roles_mapping; + +create role r1; +grant r1 to u1; +--sorted_result +select * from mysql.roles_mapping; + +drop user u1; +--error ER_NONEXISTING_GRANT +show grants for u1; +--sorted_result +select * from mysql.roles_mapping; + +drop role r1; +drop user u2; diff --git a/mysql-test/suite/roles/recursive.inc b/mysql-test/suite/roles/recursive.inc new file mode 100644 index 00000000000..940a3c9e0db --- /dev/null +++ b/mysql-test/suite/roles/recursive.inc @@ -0,0 +1,258 @@ +# +# This file tests how privilege are propagated through a complex role graph. +# Here's a graph +# +# role1 ->- role2 -->- role4 -->- role6 ->- role8 +# \ / \ +# \->- role5 ->-/ \->- role9 ->- role10 ->- foo@localhost +# / \ / +# role3 ->-/ \->- role7 ->-/ +# +# privilege checks verify that grants/revokes are propagated correctly +# from the role1 to role10. additionally debug status variables verify +# that propagation doesn't do unnecessary work (only touches the +# smallest possible number of nodes and doesn't merge privileges that +# didn't change) +# +source include/not_embedded.inc; + +create user foo@localhost; +create role role1; +create role role2; +create role role3; +create role role4; +create role role5; +create role role6; +create role role7; +create role role8; +create role role9; +create role role10; + +grant role1 to role2; +grant role2 to role4; +grant role2 to role5; +grant role3 to role5; +grant role4 to role6; +grant role5 to role6; +grant role5 to role7; +grant role6 to role8; +grant role6 to role9; +grant role7 to role9; +grant role9 to role10; +grant role10 to foo@localhost; + +# try to create a cycle +--error ER_CANNOT_GRANT_ROLE +grant role10 to role2; + +connect (foo, localhost, foo); +--sorted_result +show grants; +--sorted_result +select * from information_schema.applicable_roles; + +show status like 'debug%'; + +# +# global privileges +# +connection default; +grant select on *.* to role1; +show status like 'debug%'; +connection foo; +--error ER_TABLEACCESS_DENIED_ERROR +select count(*) from mysql.roles_mapping; +set role role10; +select count(*) from mysql.roles_mapping; +--sorted_result +show grants; +--sorted_result +select * from information_schema.enabled_roles; + +connection default; +revoke select on *.* from role1; +show status like 'debug%'; +connection foo; +# global privileges are cached in the THD, changes don't take effect immediately +select count(*) from mysql.roles_mapping; +set role none; +set role role10; +--error ER_TABLEACCESS_DENIED_ERROR +select count(*) from mysql.roles_mapping; +set role none; + +# +# database privileges +# +connection default; +grant select on mysql.* to role1; +show status like 'debug%'; +connection foo; +--error ER_TABLEACCESS_DENIED_ERROR +select count(*) from mysql.roles_mapping; +set role role10; +select count(*) from mysql.roles_mapping; +--sorted_result +show grants; + +connection default; +revoke select on mysql.* from role1; +show status like 'debug%'; +connection foo; +--error ER_TABLEACCESS_DENIED_ERROR +select count(*) from mysql.roles_mapping; +set role none; + +# +# table privileges +# + +connection default; +grant select on mysql.roles_mapping to role1; +show status like 'debug%'; +connection foo; +--error ER_TABLEACCESS_DENIED_ERROR +select count(*) from mysql.roles_mapping; +set role role10; +select count(*) from mysql.roles_mapping; +--sorted_result +show grants; + +connection default; +revoke select on mysql.roles_mapping from role1; +show status like 'debug%'; +connection foo; +--error ER_TABLEACCESS_DENIED_ERROR +select count(*) from mysql.roles_mapping; +set role none; + +# +# column privileges +# + +connection default; +grant select(User) on mysql.roles_mapping to role1; +show status like 'debug%'; +connection foo; +--error ER_TABLEACCESS_DENIED_ERROR +select count(*) from mysql.roles_mapping; +set role role10; +--error ER_COLUMNACCESS_DENIED_ERROR +select count(concat(User,Host,Role)) from mysql.roles_mapping; +select count(concat(User)) from mysql.roles_mapping; +--sorted_result +show grants; + +connection default; +grant select(Host) on mysql.roles_mapping to role3; +show status like 'debug%'; +connection foo; +--error ER_COLUMNACCESS_DENIED_ERROR +select count(concat(User,Host,Role)) from mysql.roles_mapping; +select count(concat(User,Host)) from mysql.roles_mapping; +--sorted_result +show grants; + +connection default; +revoke select(User) on mysql.roles_mapping from role1; +show status like 'debug%'; +connection foo; +--error ER_COLUMNACCESS_DENIED_ERROR +select count(concat(User,Host)) from mysql.roles_mapping; +select count(concat(Host)) from mysql.roles_mapping; + +connection default; +revoke select(Host) on mysql.roles_mapping from role3; +show status like 'debug%'; +connection foo; +--error ER_TABLEACCESS_DENIED_ERROR +select count(concat(Host)) from mysql.roles_mapping; +set role none; + +# +# routine privileges +# + +connection default; +create procedure pr1() select "pr1"; +create function fn1() returns char(10) return "fn1"; +grant execute on procedure test.pr1 to role1; +show status like 'debug%'; +connection foo; +--error ER_PROCACCESS_DENIED_ERROR +call pr1(); +set role role10; +call pr1(); +--error ER_PROCACCESS_DENIED_ERROR +select fn1(); + +connection default; +grant execute on function test.fn1 to role5; +show status like 'debug%'; +connection foo; +select fn1(); + +connection default; +revoke execute on procedure test.pr1 from role1; +show status like 'debug%'; +connection foo; +--error ER_PROCACCESS_DENIED_ERROR +call pr1(); +select fn1(); + +connection default; +revoke execute on function test.fn1 from role5; +show status like 'debug%'; +connection foo; +--error ER_PROCACCESS_DENIED_ERROR +select fn1(); +set role none; + +connection default; +drop procedure pr1; +drop function fn1; + +# +# test shortcuts +# + +grant select on mysql.roles_mapping to role3; +show status like 'debug%'; +# this grant only propagates to roles role2 and role4, +# and tries to propagate to role5, discovering that it already has it +grant select on mysql.roles_mapping to role1; +show status like 'debug%'; +# this only tries to propagate to role5 and exits early +revoke select on mysql.roles_mapping from role3; +show status like 'debug%'; +# propagates to all 8 roles, normally +revoke select on mysql.roles_mapping from role1; +show status like 'debug%'; + +grant select on mysql.* to role1; +show status like 'debug%'; +# only entries for `test` are merged, not for `mysql` +grant select on test.* to role1; +show status like 'debug%'; +revoke select on mysql.* from role1; +show status like 'debug%'; +revoke select on test.* from role1; +show status like 'debug%'; + +# +# cleanup +# + +connection default; +drop user foo@localhost; +drop role role1; +drop role role2; +drop role role3; +drop role role4; +drop role role5; +drop role role6; +drop role role7; +drop role role8; +drop role role9; +drop role role10; + diff --git a/mysql-test/suite/roles/recursive.result b/mysql-test/suite/roles/recursive.result new file mode 100644 index 00000000000..ef40c97865f --- /dev/null +++ b/mysql-test/suite/roles/recursive.result @@ -0,0 +1,328 @@ +create user foo@localhost; +create role role1; +create role role2; +create role role3; +create role role4; +create role role5; +create role role6; +create role role7; +create role role8; +create role role9; +create role role10; +grant role1 to role2; +grant role2 to role4; +grant role2 to role5; +grant role3 to role5; +grant role4 to role6; +grant role5 to role6; +grant role5 to role7; +grant role6 to role8; +grant role6 to role9; +grant role7 to role9; +grant role9 to role10; +grant role10 to foo@localhost; +grant role10 to role2; +ERROR HY000: Cannot grant role 'role10' to: 'role2'. +show grants; +Grants for foo@localhost +GRANT USAGE ON *.* TO 'foo'@'localhost' +GRANT role10 TO 'foo'@'localhost' +select * from information_schema.applicable_roles; +GRANTEE ROLE_NAME IS_GRANTABLE +foo@localhost role10 NO +role10 role9 NO +role2 role1 NO +role4 role2 NO +role5 role2 NO +role5 role3 NO +role6 role4 NO +role6 role5 NO +role7 role5 NO +role9 role6 NO +role9 role7 NO +show status like 'debug%'; +Variable_name Value +grant select on *.* to role1; +show status like 'debug%'; +Variable_name Value +select count(*) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +set role role10; +select count(*) from mysql.roles_mapping; +count(*) +22 +show grants; +Grants for foo@localhost +GRANT SELECT ON *.* TO 'role1' +GRANT USAGE ON *.* TO 'foo'@'localhost' +GRANT USAGE ON *.* TO 'role10' +GRANT USAGE ON *.* TO 'role2' +GRANT USAGE ON *.* TO 'role3' +GRANT USAGE ON *.* TO 'role4' +GRANT USAGE ON *.* TO 'role5' +GRANT USAGE ON *.* TO 'role6' +GRANT USAGE ON *.* TO 'role7' +GRANT USAGE ON *.* TO 'role9' +GRANT role1 TO 'role2' +GRANT role10 TO 'foo'@'localhost' +GRANT role2 TO 'role4' +GRANT role2 TO 'role5' +GRANT role3 TO 'role5' +GRANT role4 TO 'role6' +GRANT role5 TO 'role6' +GRANT role5 TO 'role7' +GRANT role6 TO 'role9' +GRANT role7 TO 'role9' +GRANT role9 TO 'role10' +select * from information_schema.enabled_roles; +ROLE_NAME +role1 +role10 +role2 +role3 +role4 +role5 +role6 +role7 +role9 +revoke select on *.* from role1; +show status like 'debug%'; +Variable_name Value +select count(*) from mysql.roles_mapping; +count(*) +22 +set role none; +set role role10; +select count(*) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +set role none; +grant select on mysql.* to role1; +show status like 'debug%'; +Variable_name Value +select count(*) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +set role role10; +select count(*) from mysql.roles_mapping; +count(*) +22 +show grants; +Grants for foo@localhost +GRANT SELECT ON `mysql`.* TO 'role1' +GRANT USAGE ON *.* TO 'foo'@'localhost' +GRANT USAGE ON *.* TO 'role1' +GRANT USAGE ON *.* TO 'role10' +GRANT USAGE ON *.* TO 'role2' +GRANT USAGE ON *.* TO 'role3' +GRANT USAGE ON *.* TO 'role4' +GRANT USAGE ON *.* TO 'role5' +GRANT USAGE ON *.* TO 'role6' +GRANT USAGE ON *.* TO 'role7' +GRANT USAGE ON *.* TO 'role9' +GRANT role1 TO 'role2' +GRANT role10 TO 'foo'@'localhost' +GRANT role2 TO 'role4' +GRANT role2 TO 'role5' +GRANT role3 TO 'role5' +GRANT role4 TO 'role6' +GRANT role5 TO 'role6' +GRANT role5 TO 'role7' +GRANT role6 TO 'role9' +GRANT role7 TO 'role9' +GRANT role9 TO 'role10' +revoke select on mysql.* from role1; +show status like 'debug%'; +Variable_name Value +select count(*) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +set role none; +grant select on mysql.roles_mapping to role1; +show status like 'debug%'; +Variable_name Value +select count(*) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +set role role10; +select count(*) from mysql.roles_mapping; +count(*) +22 +show grants; +Grants for foo@localhost +GRANT SELECT ON `mysql`.`roles_mapping` TO 'role1' +GRANT USAGE ON *.* TO 'foo'@'localhost' +GRANT USAGE ON *.* TO 'role1' +GRANT USAGE ON *.* TO 'role10' +GRANT USAGE ON *.* TO 'role2' +GRANT USAGE ON *.* TO 'role3' +GRANT USAGE ON *.* TO 'role4' +GRANT USAGE ON *.* TO 'role5' +GRANT USAGE ON *.* TO 'role6' +GRANT USAGE ON *.* TO 'role7' +GRANT USAGE ON *.* TO 'role9' +GRANT role1 TO 'role2' +GRANT role10 TO 'foo'@'localhost' +GRANT role2 TO 'role4' +GRANT role2 TO 'role5' +GRANT role3 TO 'role5' +GRANT role4 TO 'role6' +GRANT role5 TO 'role6' +GRANT role5 TO 'role7' +GRANT role6 TO 'role9' +GRANT role7 TO 'role9' +GRANT role9 TO 'role10' +revoke select on mysql.roles_mapping from role1; +show status like 'debug%'; +Variable_name Value +select count(*) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +set role none; +grant select(User) on mysql.roles_mapping to role1; +show status like 'debug%'; +Variable_name Value +select count(*) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +set role role10; +select count(concat(User,Host,Role)) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'Host' in table 'roles_mapping' +select count(concat(User)) from mysql.roles_mapping; +count(concat(User)) +22 +show grants; +Grants for foo@localhost +GRANT SELECT (User) ON `mysql`.`roles_mapping` TO 'role1' +GRANT USAGE ON *.* TO 'foo'@'localhost' +GRANT USAGE ON *.* TO 'role1' +GRANT USAGE ON *.* TO 'role10' +GRANT USAGE ON *.* TO 'role2' +GRANT USAGE ON *.* TO 'role3' +GRANT USAGE ON *.* TO 'role4' +GRANT USAGE ON *.* TO 'role5' +GRANT USAGE ON *.* TO 'role6' +GRANT USAGE ON *.* TO 'role7' +GRANT USAGE ON *.* TO 'role9' +GRANT role1 TO 'role2' +GRANT role10 TO 'foo'@'localhost' +GRANT role2 TO 'role4' +GRANT role2 TO 'role5' +GRANT role3 TO 'role5' +GRANT role4 TO 'role6' +GRANT role5 TO 'role6' +GRANT role5 TO 'role7' +GRANT role6 TO 'role9' +GRANT role7 TO 'role9' +GRANT role9 TO 'role10' +grant select(Host) on mysql.roles_mapping to role3; +show status like 'debug%'; +Variable_name Value +select count(concat(User,Host,Role)) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'Role' in table 'roles_mapping' +select count(concat(User,Host)) from mysql.roles_mapping; +count(concat(User,Host)) +22 +show grants; +Grants for foo@localhost +GRANT SELECT (Host) ON `mysql`.`roles_mapping` TO 'role3' +GRANT SELECT (User) ON `mysql`.`roles_mapping` TO 'role1' +GRANT USAGE ON *.* TO 'foo'@'localhost' +GRANT USAGE ON *.* TO 'role1' +GRANT USAGE ON *.* TO 'role10' +GRANT USAGE ON *.* TO 'role2' +GRANT USAGE ON *.* TO 'role3' +GRANT USAGE ON *.* TO 'role4' +GRANT USAGE ON *.* TO 'role5' +GRANT USAGE ON *.* TO 'role6' +GRANT USAGE ON *.* TO 'role7' +GRANT USAGE ON *.* TO 'role9' +GRANT role1 TO 'role2' +GRANT role10 TO 'foo'@'localhost' +GRANT role2 TO 'role4' +GRANT role2 TO 'role5' +GRANT role3 TO 'role5' +GRANT role4 TO 'role6' +GRANT role5 TO 'role6' +GRANT role5 TO 'role7' +GRANT role6 TO 'role9' +GRANT role7 TO 'role9' +GRANT role9 TO 'role10' +revoke select(User) on mysql.roles_mapping from role1; +show status like 'debug%'; +Variable_name Value +select count(concat(User,Host)) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'User' in table 'roles_mapping' +select count(concat(Host)) from mysql.roles_mapping; +count(concat(Host)) +22 +revoke select(Host) on mysql.roles_mapping from role3; +show status like 'debug%'; +Variable_name Value +select count(concat(Host)) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +set role none; +create procedure pr1() select "pr1"; +create function fn1() returns char(10) return "fn1"; +grant execute on procedure test.pr1 to role1; +show status like 'debug%'; +Variable_name Value +call pr1(); +ERROR 42000: execute command denied to user 'foo'@'localhost' for routine 'test.pr1' +set role role10; +call pr1(); +pr1 +pr1 +select fn1(); +ERROR 42000: execute command denied to user 'foo'@'localhost' for routine 'test.fn1' +grant execute on function test.fn1 to role5; +show status like 'debug%'; +Variable_name Value +select fn1(); +fn1() +fn1 +revoke execute on procedure test.pr1 from role1; +show status like 'debug%'; +Variable_name Value +call pr1(); +ERROR 42000: execute command denied to user 'foo'@'localhost' for routine 'test.pr1' +select fn1(); +fn1() +fn1 +revoke execute on function test.fn1 from role5; +show status like 'debug%'; +Variable_name Value +select fn1(); +ERROR 42000: execute command denied to user 'foo'@'localhost' for routine 'test.fn1' +set role none; +drop procedure pr1; +drop function fn1; +grant select on mysql.roles_mapping to role3; +show status like 'debug%'; +Variable_name Value +grant select on mysql.roles_mapping to role1; +show status like 'debug%'; +Variable_name Value +revoke select on mysql.roles_mapping from role3; +show status like 'debug%'; +Variable_name Value +revoke select on mysql.roles_mapping from role1; +show status like 'debug%'; +Variable_name Value +grant select on mysql.* to role1; +show status like 'debug%'; +Variable_name Value +grant select on test.* to role1; +show status like 'debug%'; +Variable_name Value +revoke select on mysql.* from role1; +show status like 'debug%'; +Variable_name Value +revoke select on test.* from role1; +show status like 'debug%'; +Variable_name Value +drop user foo@localhost; +drop role role1; +drop role role2; +drop role role3; +drop role role4; +drop role role5; +drop role role6; +drop role role7; +drop role role8; +drop role role9; +drop role role10; diff --git a/mysql-test/suite/roles/recursive.test b/mysql-test/suite/roles/recursive.test new file mode 100644 index 00000000000..0858f868d42 --- /dev/null +++ b/mysql-test/suite/roles/recursive.test @@ -0,0 +1,4 @@ + +source include/not_debug.inc; +source recursive.inc; + diff --git a/mysql-test/suite/roles/recursive_dbug.result b/mysql-test/suite/roles/recursive_dbug.result new file mode 100644 index 00000000000..268ef47232e --- /dev/null +++ b/mysql-test/suite/roles/recursive_dbug.result @@ -0,0 +1,448 @@ +show status like 'debug%'; +Variable_name Value +set @old_dbug=@@global.debug_dbug; +set global debug_dbug="+d,role_merge_stats"; +create user foo@localhost; +create role role1; +create role role2; +create role role3; +create role role4; +create role role5; +create role role6; +create role role7; +create role role8; +create role role9; +create role role10; +grant role1 to role2; +grant role2 to role4; +grant role2 to role5; +grant role3 to role5; +grant role4 to role6; +grant role5 to role6; +grant role5 to role7; +grant role6 to role8; +grant role6 to role9; +grant role7 to role9; +grant role9 to role10; +grant role10 to foo@localhost; +grant role10 to role2; +ERROR HY000: Cannot grant role 'role10' to: 'role2'. +show grants; +Grants for foo@localhost +GRANT USAGE ON *.* TO 'foo'@'localhost' +GRANT role10 TO 'foo'@'localhost' +select * from information_schema.applicable_roles; +GRANTEE ROLE_NAME IS_GRANTABLE +foo@localhost role10 NO +role10 role9 NO +role2 role1 NO +role4 role2 NO +role5 role2 NO +role5 role3 NO +role6 role4 NO +role6 role5 NO +role7 role5 NO +role9 role6 NO +role9 role7 NO +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 0 +Debug_role_merges_db 0 +Debug_role_merges_table 0 +Debug_role_merges_column 0 +Debug_role_merges_routine 0 +grant select on *.* to role1; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 8 +Debug_role_merges_db 0 +Debug_role_merges_table 0 +Debug_role_merges_column 0 +Debug_role_merges_routine 0 +select count(*) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +set role role10; +select count(*) from mysql.roles_mapping; +count(*) +22 +show grants; +Grants for foo@localhost +GRANT SELECT ON *.* TO 'role1' +GRANT USAGE ON *.* TO 'foo'@'localhost' +GRANT USAGE ON *.* TO 'role10' +GRANT USAGE ON *.* TO 'role2' +GRANT USAGE ON *.* TO 'role3' +GRANT USAGE ON *.* TO 'role4' +GRANT USAGE ON *.* TO 'role5' +GRANT USAGE ON *.* TO 'role6' +GRANT USAGE ON *.* TO 'role7' +GRANT USAGE ON *.* TO 'role9' +GRANT role1 TO 'role2' +GRANT role10 TO 'foo'@'localhost' +GRANT role2 TO 'role4' +GRANT role2 TO 'role5' +GRANT role3 TO 'role5' +GRANT role4 TO 'role6' +GRANT role5 TO 'role6' +GRANT role5 TO 'role7' +GRANT role6 TO 'role9' +GRANT role7 TO 'role9' +GRANT role9 TO 'role10' +select * from information_schema.enabled_roles; +ROLE_NAME +role1 +role10 +role2 +role3 +role4 +role5 +role6 +role7 +role9 +revoke select on *.* from role1; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 16 +Debug_role_merges_db 0 +Debug_role_merges_table 0 +Debug_role_merges_column 0 +Debug_role_merges_routine 0 +select count(*) from mysql.roles_mapping; +count(*) +22 +set role none; +set role role10; +select count(*) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +set role none; +grant select on mysql.* to role1; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 16 +Debug_role_merges_db 8 +Debug_role_merges_table 0 +Debug_role_merges_column 0 +Debug_role_merges_routine 0 +select count(*) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +set role role10; +select count(*) from mysql.roles_mapping; +count(*) +22 +show grants; +Grants for foo@localhost +GRANT SELECT ON `mysql`.* TO 'role1' +GRANT USAGE ON *.* TO 'foo'@'localhost' +GRANT USAGE ON *.* TO 'role1' +GRANT USAGE ON *.* TO 'role10' +GRANT USAGE ON *.* TO 'role2' +GRANT USAGE ON *.* TO 'role3' +GRANT USAGE ON *.* TO 'role4' +GRANT USAGE ON *.* TO 'role5' +GRANT USAGE ON *.* TO 'role6' +GRANT USAGE ON *.* TO 'role7' +GRANT USAGE ON *.* TO 'role9' +GRANT role1 TO 'role2' +GRANT role10 TO 'foo'@'localhost' +GRANT role2 TO 'role4' +GRANT role2 TO 'role5' +GRANT role3 TO 'role5' +GRANT role4 TO 'role6' +GRANT role5 TO 'role6' +GRANT role5 TO 'role7' +GRANT role6 TO 'role9' +GRANT role7 TO 'role9' +GRANT role9 TO 'role10' +revoke select on mysql.* from role1; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 16 +Debug_role_merges_db 16 +Debug_role_merges_table 0 +Debug_role_merges_column 0 +Debug_role_merges_routine 0 +select count(*) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +set role none; +grant select on mysql.roles_mapping to role1; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 16 +Debug_role_merges_db 16 +Debug_role_merges_table 8 +Debug_role_merges_column 0 +Debug_role_merges_routine 0 +select count(*) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +set role role10; +select count(*) from mysql.roles_mapping; +count(*) +22 +show grants; +Grants for foo@localhost +GRANT SELECT ON `mysql`.`roles_mapping` TO 'role1' +GRANT USAGE ON *.* TO 'foo'@'localhost' +GRANT USAGE ON *.* TO 'role1' +GRANT USAGE ON *.* TO 'role10' +GRANT USAGE ON *.* TO 'role2' +GRANT USAGE ON *.* TO 'role3' +GRANT USAGE ON *.* TO 'role4' +GRANT USAGE ON *.* TO 'role5' +GRANT USAGE ON *.* TO 'role6' +GRANT USAGE ON *.* TO 'role7' +GRANT USAGE ON *.* TO 'role9' +GRANT role1 TO 'role2' +GRANT role10 TO 'foo'@'localhost' +GRANT role2 TO 'role4' +GRANT role2 TO 'role5' +GRANT role3 TO 'role5' +GRANT role4 TO 'role6' +GRANT role5 TO 'role6' +GRANT role5 TO 'role7' +GRANT role6 TO 'role9' +GRANT role7 TO 'role9' +GRANT role9 TO 'role10' +revoke select on mysql.roles_mapping from role1; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 16 +Debug_role_merges_db 16 +Debug_role_merges_table 16 +Debug_role_merges_column 0 +Debug_role_merges_routine 0 +select count(*) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +set role none; +grant select(User) on mysql.roles_mapping to role1; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 16 +Debug_role_merges_db 16 +Debug_role_merges_table 24 +Debug_role_merges_column 8 +Debug_role_merges_routine 0 +select count(*) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +set role role10; +select count(concat(User,Host,Role)) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'Host' in table 'roles_mapping' +select count(concat(User)) from mysql.roles_mapping; +count(concat(User)) +22 +show grants; +Grants for foo@localhost +GRANT SELECT (User) ON `mysql`.`roles_mapping` TO 'role1' +GRANT USAGE ON *.* TO 'foo'@'localhost' +GRANT USAGE ON *.* TO 'role1' +GRANT USAGE ON *.* TO 'role10' +GRANT USAGE ON *.* TO 'role2' +GRANT USAGE ON *.* TO 'role3' +GRANT USAGE ON *.* TO 'role4' +GRANT USAGE ON *.* TO 'role5' +GRANT USAGE ON *.* TO 'role6' +GRANT USAGE ON *.* TO 'role7' +GRANT USAGE ON *.* TO 'role9' +GRANT role1 TO 'role2' +GRANT role10 TO 'foo'@'localhost' +GRANT role2 TO 'role4' +GRANT role2 TO 'role5' +GRANT role3 TO 'role5' +GRANT role4 TO 'role6' +GRANT role5 TO 'role6' +GRANT role5 TO 'role7' +GRANT role6 TO 'role9' +GRANT role7 TO 'role9' +GRANT role9 TO 'role10' +grant select(Host) on mysql.roles_mapping to role3; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 16 +Debug_role_merges_db 16 +Debug_role_merges_table 30 +Debug_role_merges_column 14 +Debug_role_merges_routine 0 +select count(concat(User,Host,Role)) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'Role' in table 'roles_mapping' +select count(concat(User,Host)) from mysql.roles_mapping; +count(concat(User,Host)) +22 +show grants; +Grants for foo@localhost +GRANT SELECT (Host) ON `mysql`.`roles_mapping` TO 'role3' +GRANT SELECT (User) ON `mysql`.`roles_mapping` TO 'role1' +GRANT USAGE ON *.* TO 'foo'@'localhost' +GRANT USAGE ON *.* TO 'role1' +GRANT USAGE ON *.* TO 'role10' +GRANT USAGE ON *.* TO 'role2' +GRANT USAGE ON *.* TO 'role3' +GRANT USAGE ON *.* TO 'role4' +GRANT USAGE ON *.* TO 'role5' +GRANT USAGE ON *.* TO 'role6' +GRANT USAGE ON *.* TO 'role7' +GRANT USAGE ON *.* TO 'role9' +GRANT role1 TO 'role2' +GRANT role10 TO 'foo'@'localhost' +GRANT role2 TO 'role4' +GRANT role2 TO 'role5' +GRANT role3 TO 'role5' +GRANT role4 TO 'role6' +GRANT role5 TO 'role6' +GRANT role5 TO 'role7' +GRANT role6 TO 'role9' +GRANT role7 TO 'role9' +GRANT role9 TO 'role10' +revoke select(User) on mysql.roles_mapping from role1; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 16 +Debug_role_merges_db 16 +Debug_role_merges_table 38 +Debug_role_merges_column 22 +Debug_role_merges_routine 0 +select count(concat(User,Host)) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'User' in table 'roles_mapping' +select count(concat(Host)) from mysql.roles_mapping; +count(concat(Host)) +22 +revoke select(Host) on mysql.roles_mapping from role3; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 16 +Debug_role_merges_db 16 +Debug_role_merges_table 44 +Debug_role_merges_column 28 +Debug_role_merges_routine 0 +select count(concat(Host)) from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +set role none; +create procedure pr1() select "pr1"; +create function fn1() returns char(10) return "fn1"; +grant execute on procedure test.pr1 to role1; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 16 +Debug_role_merges_db 16 +Debug_role_merges_table 44 +Debug_role_merges_column 28 +Debug_role_merges_routine 8 +call pr1(); +ERROR 42000: execute command denied to user 'foo'@'localhost' for routine 'test.pr1' +set role role10; +call pr1(); +pr1 +pr1 +select fn1(); +ERROR 42000: execute command denied to user 'foo'@'localhost' for routine 'test.fn1' +grant execute on function test.fn1 to role5; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 16 +Debug_role_merges_db 16 +Debug_role_merges_table 44 +Debug_role_merges_column 28 +Debug_role_merges_routine 13 +select fn1(); +fn1() +fn1 +revoke execute on procedure test.pr1 from role1; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 16 +Debug_role_merges_db 16 +Debug_role_merges_table 44 +Debug_role_merges_column 28 +Debug_role_merges_routine 21 +call pr1(); +ERROR 42000: execute command denied to user 'foo'@'localhost' for routine 'test.pr1' +select fn1(); +fn1() +fn1 +revoke execute on function test.fn1 from role5; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 16 +Debug_role_merges_db 16 +Debug_role_merges_table 44 +Debug_role_merges_column 28 +Debug_role_merges_routine 26 +select fn1(); +ERROR 42000: execute command denied to user 'foo'@'localhost' for routine 'test.fn1' +set role none; +drop procedure pr1; +drop function fn1; +grant select on mysql.roles_mapping to role3; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 16 +Debug_role_merges_db 16 +Debug_role_merges_table 50 +Debug_role_merges_column 28 +Debug_role_merges_routine 26 +grant select on mysql.roles_mapping to role1; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 16 +Debug_role_merges_db 16 +Debug_role_merges_table 53 +Debug_role_merges_column 28 +Debug_role_merges_routine 26 +revoke select on mysql.roles_mapping from role3; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 16 +Debug_role_merges_db 16 +Debug_role_merges_table 54 +Debug_role_merges_column 28 +Debug_role_merges_routine 26 +revoke select on mysql.roles_mapping from role1; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 16 +Debug_role_merges_db 16 +Debug_role_merges_table 62 +Debug_role_merges_column 28 +Debug_role_merges_routine 26 +grant select on mysql.* to role1; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 16 +Debug_role_merges_db 24 +Debug_role_merges_table 62 +Debug_role_merges_column 28 +Debug_role_merges_routine 26 +grant select on test.* to role1; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 16 +Debug_role_merges_db 32 +Debug_role_merges_table 62 +Debug_role_merges_column 28 +Debug_role_merges_routine 26 +revoke select on mysql.* from role1; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 16 +Debug_role_merges_db 40 +Debug_role_merges_table 62 +Debug_role_merges_column 28 +Debug_role_merges_routine 26 +revoke select on test.* from role1; +show status like 'debug%'; +Variable_name Value +Debug_role_merges_global 16 +Debug_role_merges_db 48 +Debug_role_merges_table 62 +Debug_role_merges_column 28 +Debug_role_merges_routine 26 +drop user foo@localhost; +drop role role1; +drop role role2; +drop role role3; +drop role role4; +drop role role5; +drop role role6; +drop role role7; +drop role role8; +drop role role9; +drop role role10; +set global debug_dbug=@old_dbug; diff --git a/mysql-test/suite/roles/recursive_dbug.test b/mysql-test/suite/roles/recursive_dbug.test new file mode 100644 index 00000000000..811695994e0 --- /dev/null +++ b/mysql-test/suite/roles/recursive_dbug.test @@ -0,0 +1,14 @@ +# +# run acl_roles_recursive and count the number of merges +# +source include/have_debug.inc; + +show status like 'debug%'; + +set @old_dbug=@@global.debug_dbug; +set global debug_dbug="+d,role_merge_stats"; + +source recursive.inc; + +set global debug_dbug=@old_dbug; + diff --git a/mysql-test/suite/roles/rename_user.result b/mysql-test/suite/roles/rename_user.result new file mode 100644 index 00000000000..987d90a5820 --- /dev/null +++ b/mysql-test/suite/roles/rename_user.result @@ -0,0 +1,27 @@ +create user test_user@localhost; +create role test_role1; +grant test_role1 to test_user@localhost; +create role test_role2; +grant test_role2 to test_role1; +use mysql; +select * from roles_mapping; +Host User Role Admin_option + test_role1 test_role2 N +localhost root test_role1 Y +localhost root test_role2 Y +localhost test_user test_role1 N +rename user 'test_user'@'localhost' to 'test_user_rm'@'newhost'; +select user, host from user where user like 'test%'; +user host +test_role1 +test_role2 +test_user_rm newhost +select * from roles_mapping; +Host User Role Admin_option + test_role1 test_role2 N +localhost root test_role1 Y +localhost root test_role2 Y +newhost test_user_rm test_role1 N +delete from mysql.roles_mapping; +delete from mysql.user where user like 'test%'; +flush privileges; diff --git a/mysql-test/suite/roles/rename_user.test b/mysql-test/suite/roles/rename_user.test new file mode 100644 index 00000000000..45429b76666 --- /dev/null +++ b/mysql-test/suite/roles/rename_user.test @@ -0,0 +1,38 @@ +source include/not_embedded.inc; + +#create a user with no privileges +create user test_user@localhost; +create role test_role1; +grant test_role1 to test_user@localhost; +create role test_role2; +grant test_role2 to test_role1; + +use mysql; +--sorted_result +select * from roles_mapping; + +#regular user rename +rename user 'test_user'@'localhost' to 'test_user_rm'@'newhost'; +--sorted_result +select user, host from user where user like 'test%'; +--sorted_result +select * from roles_mapping; + +######### role rename does not work yet +#rename user 'test_role2'@'' to 'test_role2_rm'@''; +#--sorted_result +#select user, host from user where user like 'test%'; +#--sorted_result +#select * from roles_mapping; +# +##role rename +#rename user 'test_role1'@'' to 'test_role1_rm'@''; +#--sorted_result +#select user, host from user where user like 'test%'; +#--sorted_result +#select * from roles_mapping; + +delete from mysql.roles_mapping; +delete from mysql.user where user like 'test%'; +flush privileges; + diff --git a/mysql-test/suite/roles/revoke_all.result b/mysql-test/suite/roles/revoke_all.result new file mode 100644 index 00000000000..7e72b5bc766 --- /dev/null +++ b/mysql-test/suite/roles/revoke_all.result @@ -0,0 +1,183 @@ +create role r1; +create role r2; +create role r3; +create role r4; +create user u1; +grant r2 to r1; +grant r3 to r2; +grant r4 to r3; +grant r1 to u1; +grant r4 to r1; +show grants for u1; +Grants for u1@% +GRANT USAGE ON *.* TO 'u1'@'%' +GRANT r1 TO 'u1'@'%' +show grants for r1; +Grants for r1 +GRANT USAGE ON *.* TO 'r1' +GRANT USAGE ON *.* TO 'r2' +GRANT USAGE ON *.* TO 'r3' +GRANT USAGE ON *.* TO 'r4' +GRANT r2 TO 'r1' +GRANT r3 TO 'r2' +GRANT r4 TO 'r1' +GRANT r4 TO 'r3' +grant SELECT on *.* to u1; +grant INSERT on mysql.* to r1; +grant DELETE on mysql.roles_mapping to r2; +grant UPDATE on mysql.user to r3; +create function mysql.test_func (s CHAR(20)) +returns CHAR(50) DETERMINISTIC +return concat('Test string: ',s); +create procedure mysql.test_proc (OUT param1 INT) +begin +select COUNT(*) into param1 from mysql.roles_mapping; +end| +grant execute on function mysql.test_func to r2; +grant execute on procedure mysql.test_proc to r3; +grant execute on mysql.* to r4; +show grants for r1; +Grants for r1 +GRANT DELETE ON `mysql`.`roles_mapping` TO 'r2' +GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO 'r2' +GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO 'r3' +GRANT EXECUTE ON `mysql`.* TO 'r4' +GRANT INSERT ON `mysql`.* TO 'r1' +GRANT UPDATE ON `mysql`.`user` TO 'r3' +GRANT USAGE ON *.* TO 'r1' +GRANT USAGE ON *.* TO 'r2' +GRANT USAGE ON *.* TO 'r3' +GRANT USAGE ON *.* TO 'r4' +GRANT r2 TO 'r1' +GRANT r3 TO 'r2' +GRANT r4 TO 'r1' +GRANT r4 TO 'r3' +show grants for r2; +Grants for r2 +GRANT DELETE ON `mysql`.`roles_mapping` TO 'r2' +GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO 'r2' +GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO 'r3' +GRANT EXECUTE ON `mysql`.* TO 'r4' +GRANT UPDATE ON `mysql`.`user` TO 'r3' +GRANT USAGE ON *.* TO 'r2' +GRANT USAGE ON *.* TO 'r3' +GRANT USAGE ON *.* TO 'r4' +GRANT r3 TO 'r2' +GRANT r4 TO 'r3' +show grants for r3; +Grants for r3 +GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO 'r3' +GRANT EXECUTE ON `mysql`.* TO 'r4' +GRANT UPDATE ON `mysql`.`user` TO 'r3' +GRANT USAGE ON *.* TO 'r3' +GRANT USAGE ON *.* TO 'r4' +GRANT r4 TO 'r3' +show grants for r4; +Grants for r4 +GRANT EXECUTE ON `mysql`.* TO 'r4' +GRANT USAGE ON *.* TO 'r4' +revoke all privileges, grant option from r4; +show grants for r1; +Grants for r1 +GRANT DELETE ON `mysql`.`roles_mapping` TO 'r2' +GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO 'r2' +GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO 'r3' +GRANT INSERT ON `mysql`.* TO 'r1' +GRANT UPDATE ON `mysql`.`user` TO 'r3' +GRANT USAGE ON *.* TO 'r1' +GRANT USAGE ON *.* TO 'r2' +GRANT USAGE ON *.* TO 'r3' +GRANT USAGE ON *.* TO 'r4' +GRANT r2 TO 'r1' +GRANT r3 TO 'r2' +GRANT r4 TO 'r1' +GRANT r4 TO 'r3' +show grants for r2; +Grants for r2 +GRANT DELETE ON `mysql`.`roles_mapping` TO 'r2' +GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO 'r2' +GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO 'r3' +GRANT UPDATE ON `mysql`.`user` TO 'r3' +GRANT USAGE ON *.* TO 'r2' +GRANT USAGE ON *.* TO 'r3' +GRANT USAGE ON *.* TO 'r4' +GRANT r3 TO 'r2' +GRANT r4 TO 'r3' +show grants for r3; +Grants for r3 +GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO 'r3' +GRANT UPDATE ON `mysql`.`user` TO 'r3' +GRANT USAGE ON *.* TO 'r3' +GRANT USAGE ON *.* TO 'r4' +GRANT r4 TO 'r3' +show grants for r4; +Grants for r4 +GRANT USAGE ON *.* TO 'r4' +revoke all privileges, grant option from r3; +show grants for r1; +Grants for r1 +GRANT DELETE ON `mysql`.`roles_mapping` TO 'r2' +GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO 'r2' +GRANT INSERT ON `mysql`.* TO 'r1' +GRANT USAGE ON *.* TO 'r1' +GRANT USAGE ON *.* TO 'r2' +GRANT USAGE ON *.* TO 'r3' +GRANT USAGE ON *.* TO 'r4' +GRANT r2 TO 'r1' +GRANT r3 TO 'r2' +GRANT r4 TO 'r1' +show grants for r2; +Grants for r2 +GRANT DELETE ON `mysql`.`roles_mapping` TO 'r2' +GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO 'r2' +GRANT USAGE ON *.* TO 'r2' +GRANT USAGE ON *.* TO 'r3' +GRANT r3 TO 'r2' +show grants for r3; +Grants for r3 +GRANT USAGE ON *.* TO 'r3' +show grants for r4; +Grants for r4 +GRANT USAGE ON *.* TO 'r4' +revoke all privileges, grant option from r2; +show grants for r1; +Grants for r1 +GRANT INSERT ON `mysql`.* TO 'r1' +GRANT USAGE ON *.* TO 'r1' +GRANT USAGE ON *.* TO 'r2' +GRANT USAGE ON *.* TO 'r4' +GRANT r2 TO 'r1' +GRANT r4 TO 'r1' +show grants for r2; +Grants for r2 +GRANT USAGE ON *.* TO 'r2' +show grants for r3; +Grants for r3 +GRANT USAGE ON *.* TO 'r3' +show grants for r4; +Grants for r4 +GRANT USAGE ON *.* TO 'r4' +revoke all privileges, grant option from r1; +show grants for r1; +Grants for r1 +GRANT USAGE ON *.* TO 'r1' +show grants for r2; +Grants for r2 +GRANT USAGE ON *.* TO 'r2' +show grants for r3; +Grants for r3 +GRANT USAGE ON *.* TO 'r3' +show grants for r4; +Grants for r4 +GRANT USAGE ON *.* TO 'r4' +revoke all privileges, grant option from u1; +show grants for u1; +Grants for u1@% +GRANT USAGE ON *.* TO 'u1'@'%' +drop function mysql.test_func; +drop procedure mysql.test_proc; +show grants for r1; +Grants for r1 +GRANT USAGE ON *.* TO 'r1' +drop role r1, r2, r3, r4; +drop user u1; diff --git a/mysql-test/suite/roles/revoke_all.test b/mysql-test/suite/roles/revoke_all.test new file mode 100644 index 00000000000..a3dee981c40 --- /dev/null +++ b/mysql-test/suite/roles/revoke_all.test @@ -0,0 +1,103 @@ +source include/not_embedded.inc; + +create role r1; +create role r2; +create role r3; +create role r4; +create user u1; + +#CREATE A CHAIN OF ROLES +grant r2 to r1; +grant r3 to r2; +grant r4 to r3; +grant r1 to u1; +grant r4 to r1; + +--sorted_result +show grants for u1; +--sorted_result +show grants for r1; + +grant SELECT on *.* to u1; +grant INSERT on mysql.* to r1; +grant DELETE on mysql.roles_mapping to r2; +grant UPDATE on mysql.user to r3; + +create function mysql.test_func (s CHAR(20)) +returns CHAR(50) DETERMINISTIC +return concat('Test string: ',s); + + +delimiter |; +create procedure mysql.test_proc (OUT param1 INT) +begin + select COUNT(*) into param1 from mysql.roles_mapping; +end| +delimiter ;| + +grant execute on function mysql.test_func to r2; +grant execute on procedure mysql.test_proc to r3; +grant execute on mysql.* to r4; + +--sorted_result +show grants for r1; +--sorted_result +show grants for r2; +--sorted_result +show grants for r3; +--sorted_result +show grants for r4; + +revoke all privileges, grant option from r4; + +--sorted_result +show grants for r1; +--sorted_result +show grants for r2; +--sorted_result +show grants for r3; +--sorted_result +show grants for r4; + +revoke all privileges, grant option from r3; +--sorted_result +show grants for r1; +--sorted_result +show grants for r2; +--sorted_result +show grants for r3; +--sorted_result +show grants for r4; + +revoke all privileges, grant option from r2; +--sorted_result +show grants for r1; +--sorted_result +show grants for r2; +--sorted_result +show grants for r3; +--sorted_result +show grants for r4; + +revoke all privileges, grant option from r1; +--sorted_result +show grants for r1; +--sorted_result +show grants for r2; +--sorted_result +show grants for r3; +--sorted_result +show grants for r4; + +revoke all privileges, grant option from u1; + +show grants for u1; + +drop function mysql.test_func; +drop procedure mysql.test_proc; + +--sorted_result +show grants for r1; + +drop role r1, r2, r3, r4; +drop user u1; diff --git a/mysql-test/suite/roles/rpl_definer.result b/mysql-test/suite/roles/rpl_definer.result new file mode 100644 index 00000000000..eadb6315d9b --- /dev/null +++ b/mysql-test/suite/roles/rpl_definer.result @@ -0,0 +1,72 @@ +include/master-slave.inc +[connection master] +create role role1; +create role role2; +grant execute on test.* to role2; +grant role2 to role1; +set role role1; +show grants; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +GRANT EXECUTE ON `test`.* TO 'role2' +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION +GRANT USAGE ON *.* TO 'role1' +GRANT USAGE ON *.* TO 'role2' +GRANT role1 TO 'root'@'localhost' WITH ADMIN OPTION +GRANT role2 TO 'role1' +GRANT role2 TO 'root'@'localhost' WITH ADMIN OPTION +create definer=current_user procedure pcu() select current_user; +create definer=root@localhost procedure pu() select "root@localhost"; +create definer=current_role procedure pcr() select current_role; +create definer=role1 procedure pr() select "role1"; +show create procedure pcu; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +pcu CREATE DEFINER=`root`@`localhost` PROCEDURE `pcu`() +select current_user latin1 latin1_swedish_ci latin1_swedish_ci +show create procedure pu; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +pu CREATE DEFINER=`root`@`localhost` PROCEDURE `pu`() +select "root@localhost" latin1 latin1_swedish_ci latin1_swedish_ci +show create procedure pcr; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +pcr CREATE DEFINER=`role1` PROCEDURE `pcr`() +select current_role latin1 latin1_swedish_ci latin1_swedish_ci +show create procedure pr; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +pr CREATE DEFINER=`role1` PROCEDURE `pr`() +select "role1" latin1 latin1_swedish_ci latin1_swedish_ci +[connection slave] +set role role1; +show grants; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +GRANT EXECUTE ON `test`.* TO 'role2' +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION +GRANT USAGE ON *.* TO 'role1' +GRANT USAGE ON *.* TO 'role2' +GRANT role1 TO 'root'@'localhost' WITH ADMIN OPTION +GRANT role2 TO 'role1' +GRANT role2 TO 'root'@'localhost' WITH ADMIN OPTION +show create procedure pcu; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +pcu CREATE DEFINER=`root`@`localhost` PROCEDURE `pcu`() +select current_user latin1 latin1_swedish_ci latin1_swedish_ci +show create procedure pu; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +pu CREATE DEFINER=`root`@`localhost` PROCEDURE `pu`() +select "root@localhost" latin1 latin1_swedish_ci latin1_swedish_ci +show create procedure pcr; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +pcr CREATE DEFINER=`role1` PROCEDURE `pcr`() +select current_role latin1 latin1_swedish_ci latin1_swedish_ci +show create procedure pr; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +pr CREATE DEFINER=`role1` PROCEDURE `pr`() +select "role1" latin1 latin1_swedish_ci latin1_swedish_ci +drop procedure pcu; +drop procedure pu; +drop procedure pcr; +drop procedure pr; +drop role role1; +drop role role2; +include/rpl_end.inc diff --git a/mysql-test/suite/roles/rpl_definer.test b/mysql-test/suite/roles/rpl_definer.test new file mode 100644 index 00000000000..86d69de86aa --- /dev/null +++ b/mysql-test/suite/roles/rpl_definer.test @@ -0,0 +1,48 @@ +# +# replication of the DEFINER=current_role +# + +--source include/master-slave.inc + +create role role1; +create role role2; +grant execute on test.* to role2; +grant role2 to role1; +set role role1; +--sorted_result +show grants; + +create definer=current_user procedure pcu() select current_user; +create definer=root@localhost procedure pu() select "root@localhost"; +create definer=current_role procedure pcr() select current_role; +create definer=role1 procedure pr() select "role1"; + +show create procedure pcu; +show create procedure pu; +show create procedure pcr; +show create procedure pr; + +sync_slave_with_master; +connection slave; +echo [connection slave]; + +set role role1; +--sorted_result +show grants; + +show create procedure pcu; +show create procedure pu; +show create procedure pcr; +show create procedure pr; + +connection master; + +drop procedure pcu; +drop procedure pu; +drop procedure pcr; +drop procedure pr; +drop role role1; +drop role role2; + +--source include/rpl_end.inc + diff --git a/mysql-test/suite/roles/set_and_drop.result b/mysql-test/suite/roles/set_and_drop.result new file mode 100644 index 00000000000..1814c19cc97 --- /dev/null +++ b/mysql-test/suite/roles/set_and_drop.result @@ -0,0 +1,117 @@ +create database mysqltest1; +create table mysqltest1.t1 (a int, b int); +create table mysqltest1.t2 (a int, b int); +insert mysqltest1.t1 values (1,2),(3,4); +insert mysqltest1.t2 values (5,6),(7,8); +create procedure mysqltest1.pr1() select "pr1"; +create user foo@localhost; +create role role1; +create role role2; +grant role2 to role1; +grant role1 to foo@localhost; +grant reload on *.* to role2; +grant select on mysql.* to role2; +grant execute on procedure mysqltest1.pr1 to role2; +grant select on mysqltest1.t1 to role2; +grant select (a) on mysqltest1.t2 to role2; +flush tables; +ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation +select * from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +show tables from mysqltest1; +ERROR 42000: Access denied for user 'foo'@'localhost' to database 'mysqltest1' +set role role1; +flush tables; +select * from mysql.roles_mapping; +Host User Role Admin_option + role1 role2 N +localhost foo role1 N +localhost root role1 Y +localhost root role2 Y +show tables from mysqltest1; +Tables_in_mysqltest1 +t1 +t2 +select * from mysqltest1.t1; +a b +1 2 +3 4 +select * from mysqltest1.t2; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't2' +select a from mysqltest1.t2; +a +5 +7 +call mysqltest1.pr1(); +pr1 +pr1 +revoke execute on procedure mysqltest1.pr1 from role2; +call mysqltest1.pr1(); +ERROR 42000: execute command denied to user 'foo'@'localhost' for routine 'mysqltest1.pr1' +drop role role2; +show grants; +Grants for foo@localhost +GRANT role1 TO 'foo'@'localhost' +GRANT USAGE ON *.* TO 'foo'@'localhost' +GRANT USAGE ON *.* TO 'role1' +select * from information_schema.enabled_roles; +ROLE_NAME +role1 +flush tables; +select * from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +select * from mysqltest1.t1; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1' +select a from mysqltest1.t2; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't2' +set role none; +grant reload on *.* to role1; +grant select on mysql.* to role1; +grant execute on procedure mysqltest1.pr1 to role1; +grant select on mysqltest1.t1 to role1; +grant select (a) on mysqltest1.t2 to role1; +set role role1; +flush tables; +select * from mysql.roles_mapping; +Host User Role Admin_option +localhost foo role1 N +localhost root role1 Y +show tables from mysqltest1; +Tables_in_mysqltest1 +t1 +t2 +select * from mysqltest1.t1; +a b +1 2 +3 4 +select * from mysqltest1.t2; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't2' +select a from mysqltest1.t2; +a +5 +7 +call mysqltest1.pr1(); +pr1 +pr1 +drop role role1; +flush tables; +select * from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'roles_mapping' +select * from mysqltest1.t1; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1' +select a from mysqltest1.t2; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't2' +show grants; +Grants for foo@localhost +GRANT USAGE ON *.* TO 'foo'@'localhost' +select * from information_schema.enabled_roles; +ROLE_NAME +NULL +select * from information_schema.enabled_roles; +ROLE_NAME +NULL +select current_role(); +current_role() +role1 +drop user foo@localhost; +drop database mysqltest1; diff --git a/mysql-test/suite/roles/set_and_drop.test b/mysql-test/suite/roles/set_and_drop.test new file mode 100644 index 00000000000..852e79fd109 --- /dev/null +++ b/mysql-test/suite/roles/set_and_drop.test @@ -0,0 +1,113 @@ +--source include/not_embedded.inc +# +# test setting and dropping a role +# + +create database mysqltest1; +create table mysqltest1.t1 (a int, b int); +create table mysqltest1.t2 (a int, b int); +insert mysqltest1.t1 values (1,2),(3,4); +insert mysqltest1.t2 values (5,6),(7,8); + +create procedure mysqltest1.pr1() select "pr1"; + +create user foo@localhost; +create role role1; +create role role2; + +grant role2 to role1; +grant role1 to foo@localhost; +grant reload on *.* to role2; +grant select on mysql.* to role2; +grant execute on procedure mysqltest1.pr1 to role2; +grant select on mysqltest1.t1 to role2; +grant select (a) on mysqltest1.t2 to role2; + +connect (foo,localhost,foo); + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +flush tables; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysql.roles_mapping; +--error ER_DBACCESS_DENIED_ERROR +show tables from mysqltest1; + +set role role1; + +flush tables; +--sorted_result +select * from mysql.roles_mapping; +show tables from mysqltest1; +select * from mysqltest1.t1; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysqltest1.t2; +select a from mysqltest1.t2; +call mysqltest1.pr1(); + +connection default; +revoke execute on procedure mysqltest1.pr1 from role2; +connection foo; + +--error ER_PROCACCESS_DENIED_ERROR +call mysqltest1.pr1(); + +connection default; +drop role role2; +connection foo; + +show grants; +select * from information_schema.enabled_roles; + +flush tables; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysql.roles_mapping; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysqltest1.t1; +--error ER_TABLEACCESS_DENIED_ERROR +select a from mysqltest1.t2; + +set role none; + +connection default; + +grant reload on *.* to role1; +grant select on mysql.* to role1; +grant execute on procedure mysqltest1.pr1 to role1; +grant select on mysqltest1.t1 to role1; +grant select (a) on mysqltest1.t2 to role1; + +connection foo; +set role role1; + +flush tables; +--sorted_result +select * from mysql.roles_mapping; +show tables from mysqltest1; +select * from mysqltest1.t1; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysqltest1.t2; +select a from mysqltest1.t2; +call mysqltest1.pr1(); + +connection default; +drop role role1; +connection foo; + +flush tables; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysql.roles_mapping; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysqltest1.t1; +--error ER_TABLEACCESS_DENIED_ERROR +select a from mysqltest1.t2; + +show grants; +select * from information_schema.enabled_roles; +select * from information_schema.enabled_roles; # yes, repeat it twice +select current_role(); + +disconnect foo; +connection default; + +drop user foo@localhost; +drop database mysqltest1; diff --git a/mysql-test/suite/roles/set_role-database-recursive.result b/mysql-test/suite/roles/set_role-database-recursive.result new file mode 100644 index 00000000000..479e553c3d1 --- /dev/null +++ b/mysql-test/suite/roles/set_role-database-recursive.result @@ -0,0 +1,83 @@ +create user test_user@localhost; +create role test_role1; +create role test_role2; +grant test_role1 to test_user@localhost; +grant test_role2 to test_user@localhost; +grant test_role2 to test_role1; +select user, host from mysql.user where user not like 'root'; +user host +test_role1 +test_role2 +test_user localhost +select * from mysql.roles_mapping; +Host User Role Admin_option + test_role1 test_role2 N +localhost root test_role1 Y +localhost root test_role2 Y +localhost test_user test_role1 N +localhost test_user test_role2 N +select user, host from mysql.db; +user host + % + % +grant select on mysql.* to test_role2; +flush privileges; +select * from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NULL +set role test_role1; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role1 +select * from mysql.roles_mapping; +Host User Role Admin_option + test_role1 test_role2 N +localhost root test_role1 Y +localhost root test_role2 Y +localhost test_user test_role1 N +localhost test_user test_role2 N +set role none; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NULL +select * from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +set role test_role2; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role2 +select * from mysql.roles_mapping; +Host User Role Admin_option + test_role1 test_role2 N +localhost root test_role1 Y +localhost root test_role2 Y +localhost test_user test_role1 N +localhost test_user test_role2 N +create role test_role3; +grant test_role3 to test_role2; +create role test_role4; +grant test_role4 to test_role3; +set role test_role1; +delete from mysql.user where user='no such user'; +ERROR 42000: DELETE command denied to user 'test_user'@'localhost' for table 'user' +grant delete on mysql.* to test_role4; +set role test_role1; +delete from mysql.user where user='no such user'; +show grants; +Grants for test_user@localhost +GRANT DELETE ON `mysql`.* TO 'test_role4' +GRANT SELECT ON `mysql`.* TO 'test_role2' +GRANT USAGE ON *.* TO 'test_role1' +GRANT USAGE ON *.* TO 'test_role2' +GRANT USAGE ON *.* TO 'test_role3' +GRANT USAGE ON *.* TO 'test_role4' +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role2 TO 'test_role1' +GRANT test_role2 TO 'test_user'@'localhost' +GRANT test_role3 TO 'test_role2' +GRANT test_role4 TO 'test_role3' +drop user test_user@localhost; +drop role test_role1, test_role2, test_role3, test_role4; diff --git a/mysql-test/suite/roles/set_role-database-recursive.test b/mysql-test/suite/roles/set_role-database-recursive.test new file mode 100644 index 00000000000..17c93d4571f --- /dev/null +++ b/mysql-test/suite/roles/set_role-database-recursive.test @@ -0,0 +1,64 @@ +source include/not_embedded.inc; + +#create a user with no privileges +create user test_user@localhost; +create role test_role1; +create role test_role2; + +grant test_role1 to test_user@localhost; +grant test_role2 to test_user@localhost; +grant test_role2 to test_role1; +--sorted_result +select user, host from mysql.user where user not like 'root'; +--sorted_result +select * from mysql.roles_mapping; + +--sorted_result +select user, host from mysql.db; + +grant select on mysql.* to test_role2; +flush privileges; + +change_user 'test_user'; + +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysql.roles_mapping; + +select current_user(), current_role(); +set role test_role1; +select current_user(), current_role(); +--sorted_result +select * from mysql.roles_mapping; +set role none; +select current_user(), current_role(); +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysql.roles_mapping; +set role test_role2; +select current_user(), current_role(); +--sorted_result +select * from mysql.roles_mapping; + +change_user 'root'; + +create role test_role3; +grant test_role3 to test_role2; +create role test_role4; +grant test_role4 to test_role3; + +change_user 'test_user'; +set role test_role1; +--error ER_TABLEACCESS_DENIED_ERROR +delete from mysql.user where user='no such user'; + +change_user 'root'; +grant delete on mysql.* to test_role4; + +change_user 'test_user'; +set role test_role1; +delete from mysql.user where user='no such user'; +--sorted_result +show grants; + +change_user 'root'; +drop user test_user@localhost; +drop role test_role1, test_role2, test_role3, test_role4; diff --git a/mysql-test/suite/roles/set_role-database-simple.result b/mysql-test/suite/roles/set_role-database-simple.result new file mode 100644 index 00000000000..e21a55edf2e --- /dev/null +++ b/mysql-test/suite/roles/set_role-database-simple.result @@ -0,0 +1,52 @@ +create user 'test_user'@'localhost'; +create role test_role1; +grant test_role1 to test_user@localhost; +select user, host from mysql.user where user not like 'root'; +user host +test_role1 +test_user localhost +select * from mysql.roles_mapping; +Host User Role Admin_option +localhost root test_role1 Y +localhost test_user test_role1 N +grant select on mysql.* to test_role1; +grant insert, delete on mysql.roles_mapping to test_role1; +grant reload on *.* to test_role1; +select * from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NULL +set role test_role1; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role1 +select * from mysql.roles_mapping; +Host User Role Admin_option +localhost root test_role1 Y +localhost test_user test_role1 N +insert into mysql.user (user, host) values ('Dummy', 'Dummy'); +ERROR 42000: INSERT command denied to user 'test_user'@'localhost' for table 'user' +insert into mysql.roles_mapping values ('localhost', 'test_user', 'test_role2', 'N'); +delete from mysql.roles_mapping where Role='test_role2'; +use mysql; +set role none; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NULL +use mysql; +ERROR 42000: Access denied for user 'test_user'@'localhost' to database 'mysql' +select * from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +insert into mysql.user (user, host) values ('Dummy', 'Dummy'); +ERROR 42000: INSERT command denied to user 'test_user'@'localhost' for table 'user' +insert into mysql.roles_mapping values ('localhost', 'test_user', 'test_role2', 'N'); +ERROR 42000: INSERT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +delete from mysql.roles_mapping where Role='test_role2'; +ERROR 42000: DELETE command denied to user 'test_user'@'localhost' for table 'roles_mapping' +drop user 'test_user'@'localhost'; +revoke select on mysql.* from test_role1; +revoke insert, delete on mysql.roles_mapping from test_role1; +drop role test_role1; +delete from mysql.roles_mapping where Role='test_role1'; +flush privileges; diff --git a/mysql-test/suite/roles/set_role-database-simple.test b/mysql-test/suite/roles/set_role-database-simple.test new file mode 100644 index 00000000000..daac13a095d --- /dev/null +++ b/mysql-test/suite/roles/set_role-database-simple.test @@ -0,0 +1,56 @@ +source include/not_embedded.inc; + +#create a user with no privileges +create user 'test_user'@'localhost'; +create role test_role1; + +grant test_role1 to test_user@localhost; +--sorted_result +select user, host from mysql.user where user not like 'root'; +--sorted_result +select * from mysql.roles_mapping; + +grant select on mysql.* to test_role1; +grant insert, delete on mysql.roles_mapping to test_role1; + +grant reload on *.* to test_role1; + +change_user 'test_user'; + +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysql.roles_mapping; + +select current_user(), current_role(); +set role test_role1; +select current_user(), current_role(); +--sorted_result +select * from mysql.roles_mapping; +--error ER_TABLEACCESS_DENIED_ERROR +insert into mysql.user (user, host) values ('Dummy', 'Dummy'); +insert into mysql.roles_mapping values ('localhost', 'test_user', 'test_role2', 'N'); +delete from mysql.roles_mapping where Role='test_role2'; + +use mysql; + +set role none; +select current_user(), current_role(); + +--error ER_DBACCESS_DENIED_ERROR +use mysql; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysql.roles_mapping; +--error ER_TABLEACCESS_DENIED_ERROR +insert into mysql.user (user, host) values ('Dummy', 'Dummy'); +--error ER_TABLEACCESS_DENIED_ERROR +insert into mysql.roles_mapping values ('localhost', 'test_user', 'test_role2', 'N'); +--error ER_TABLEACCESS_DENIED_ERROR +delete from mysql.roles_mapping where Role='test_role2'; + +change_user 'root'; +drop user 'test_user'@'localhost'; +revoke select on mysql.* from test_role1; +revoke insert, delete on mysql.roles_mapping from test_role1; +drop role test_role1; +delete from mysql.roles_mapping where Role='test_role1'; +flush privileges; + diff --git a/mysql-test/suite/roles/set_role-multiple-role.result b/mysql-test/suite/roles/set_role-multiple-role.result new file mode 100644 index 00000000000..fca53b4d645 --- /dev/null +++ b/mysql-test/suite/roles/set_role-multiple-role.result @@ -0,0 +1,147 @@ +create user 'test_user'@'localhost'; +create role r_sel; +create role r_ins; +create role r_upd; +create role r_del; +create role r_crt; +create role r_drp; +create role r_rld; +grant select on *.* to r_sel; +grant insert on *.* to r_ins; +grant update on *.* to r_upd; +grant delete on *.* to r_del; +grant create on *.* to r_crt; +grant drop on *.* to r_drp; +grant reload on *.* to r_rld; +grant r_sel to test_user@localhost; +grant r_ins to test_user@localhost; +grant r_upd to test_user@localhost; +grant r_del to test_user@localhost; +grant r_crt to test_user@localhost; +grant r_drp to test_user@localhost; +grant r_rld to test_user@localhost; +flush privileges; +select * from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +show grants; +Grants for test_user@localhost +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT r_crt TO 'test_user'@'localhost' +GRANT r_del TO 'test_user'@'localhost' +GRANT r_drp TO 'test_user'@'localhost' +GRANT r_ins TO 'test_user'@'localhost' +GRANT r_rld TO 'test_user'@'localhost' +GRANT r_sel TO 'test_user'@'localhost' +GRANT r_upd TO 'test_user'@'localhost' +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NULL +set role r_sel; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost r_sel +show grants; +Grants for test_user@localhost +GRANT SELECT ON *.* TO 'r_sel' +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT r_crt TO 'test_user'@'localhost' +GRANT r_del TO 'test_user'@'localhost' +GRANT r_drp TO 'test_user'@'localhost' +GRANT r_ins TO 'test_user'@'localhost' +GRANT r_rld TO 'test_user'@'localhost' +GRANT r_sel TO 'test_user'@'localhost' +GRANT r_upd TO 'test_user'@'localhost' +select * from mysql.roles_mapping; +Host User Role Admin_option +localhost root r_crt Y +localhost root r_del Y +localhost root r_drp Y +localhost root r_ins Y +localhost root r_rld Y +localhost root r_sel Y +localhost root r_upd Y +localhost test_user r_crt N +localhost test_user r_del N +localhost test_user r_drp N +localhost test_user r_ins N +localhost test_user r_rld N +localhost test_user r_sel N +localhost test_user r_upd N +set role r_ins; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost r_ins +show grants; +Grants for test_user@localhost +GRANT INSERT ON *.* TO 'r_ins' +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT r_crt TO 'test_user'@'localhost' +GRANT r_del TO 'test_user'@'localhost' +GRANT r_drp TO 'test_user'@'localhost' +GRANT r_ins TO 'test_user'@'localhost' +GRANT r_rld TO 'test_user'@'localhost' +GRANT r_sel TO 'test_user'@'localhost' +GRANT r_upd TO 'test_user'@'localhost' +select * from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +insert into mysql.roles_mapping values ('', 'r_sel', 'r_rld', 'N'); +flush privileges; +ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation +set role r_rld; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost r_rld +flush privileges; +set role r_sel; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost r_sel +flush privileges; +set role none; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NULL +flush privileges; +ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation +set role r_ins; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost r_ins +insert into mysql.roles_mapping values ('', 'r_sel', 'r_upd', 'N'); +insert into mysql.roles_mapping values ('', 'r_sel', 'r_del', 'N'); +insert into mysql.roles_mapping values ('', 'r_sel', 'r_crt', 'N'); +insert into mysql.roles_mapping values ('', 'r_sel', 'r_drp', 'N'); +insert into mysql.roles_mapping values ('', 'r_del', 'r_ins', 'N'); +set role r_rld; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost r_rld +flush privileges; +set role r_sel; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost r_sel +update mysql.roles_mapping set Role='r_ins' where Role='r_ins_wrong'; +flush privileges; +set role r_sel; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost r_sel +create table mysql.random_test_table (id INT); +insert into mysql.random_test_table values (1); +select * from mysql.random_test_table; +id +1 +delete from mysql.roles_mapping where Role='r_ins'; +flush privileges; +set role r_sel; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost r_sel +insert into mysql.random_test_table values (1); +ERROR 42000: INSERT command denied to user 'test_user'@'localhost' for table 'random_test_table' +drop table mysql.random_test_table; +delete from mysql.user where user like 'r\_%'; +delete from mysql.roles_mapping where Role like 'r\_%'; +flush privileges; +drop user 'test_user'@'localhost'; diff --git a/mysql-test/suite/roles/set_role-multiple-role.test b/mysql-test/suite/roles/set_role-multiple-role.test new file mode 100644 index 00000000000..ecfe8869c12 --- /dev/null +++ b/mysql-test/suite/roles/set_role-multiple-role.test @@ -0,0 +1,102 @@ +source include/not_embedded.inc; + +#create a user with no privileges +create user 'test_user'@'localhost'; + +create role r_sel; +create role r_ins; +create role r_upd; +create role r_del; +create role r_crt; +create role r_drp; +create role r_rld; + +grant select on *.* to r_sel; +grant insert on *.* to r_ins; +grant update on *.* to r_upd; +grant delete on *.* to r_del; +grant create on *.* to r_crt; +grant drop on *.* to r_drp; +grant reload on *.* to r_rld; + +##################################### +#set up roles mapping +##################################### +grant r_sel to test_user@localhost; +grant r_ins to test_user@localhost; +grant r_upd to test_user@localhost; +grant r_del to test_user@localhost; +grant r_crt to test_user@localhost; +grant r_drp to test_user@localhost; +grant r_rld to test_user@localhost; +flush privileges; + +change_user 'test_user'; + +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysql.roles_mapping; + +--sorted_result +show grants; +select current_user(), current_role(); +set role r_sel; +select current_user(), current_role(); +--sorted_result +show grants; +--sorted_result +select * from mysql.roles_mapping; + +set role r_ins; +select current_user(), current_role(); +--sorted_result +show grants; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysql.roles_mapping; +insert into mysql.roles_mapping values ('', 'r_sel', 'r_rld', 'N'); +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +flush privileges; +set role r_rld; +select current_user(), current_role(); +flush privileges; +set role r_sel; +select current_user(), current_role(); +flush privileges; +set role none; +select current_user(), current_role(); +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +flush privileges; + +set role r_ins; +select current_user(), current_role(); +insert into mysql.roles_mapping values ('', 'r_sel', 'r_upd', 'N'); +insert into mysql.roles_mapping values ('', 'r_sel', 'r_del', 'N'); +insert into mysql.roles_mapping values ('', 'r_sel', 'r_crt', 'N'); +insert into mysql.roles_mapping values ('', 'r_sel', 'r_drp', 'N'); +insert into mysql.roles_mapping values ('', 'r_del', 'r_ins', 'N'); +set role r_rld; +select current_user(), current_role(); +flush privileges; +set role r_sel; +select current_user(), current_role(); +update mysql.roles_mapping set Role='r_ins' where Role='r_ins_wrong'; +flush privileges; +set role r_sel; +select current_user(), current_role(); + +create table mysql.random_test_table (id INT); +insert into mysql.random_test_table values (1); +--sorted_result +select * from mysql.random_test_table; +delete from mysql.roles_mapping where Role='r_ins'; +flush privileges; +set role r_sel; +select current_user(), current_role(); +--error ER_TABLEACCESS_DENIED_ERROR +insert into mysql.random_test_table values (1); +drop table mysql.random_test_table; + +change_user 'root'; +delete from mysql.user where user like 'r\_%'; +delete from mysql.roles_mapping where Role like 'r\_%'; +flush privileges; +drop user 'test_user'@'localhost'; diff --git a/mysql-test/suite/roles/set_role-recursive.result b/mysql-test/suite/roles/set_role-recursive.result new file mode 100644 index 00000000000..0bec8026ab5 --- /dev/null +++ b/mysql-test/suite/roles/set_role-recursive.result @@ -0,0 +1,118 @@ +create user test_user@localhost; +create role test_role1; +grant test_role1 to test_user@localhost; +create role test_role2; +grant test_role2 to test_role1; +select user, host from mysql.user where user not like 'root'; +user host +test_role1 +test_role2 +test_user localhost +select * from mysql.roles_mapping where User like 'test_user'; +Host User Role Admin_option +localhost test_user test_role1 N +select * from mysql.roles_mapping where User like 'test_role1'; +Host User Role Admin_option + test_role1 test_role2 N +grant select on *.* to test_role2; +select * from mysql.user where user like 'test_role1'; +Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role + test_role1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 N Y +select * from mysql.user where user like 'test_role2'; +Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role + test_role2 Y N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 N Y +select * from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +show grants; +Grants for test_user@localhost +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NULL +set role test_role1; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role1 +show grants; +Grants for test_user@localhost +GRANT SELECT ON *.* TO 'test_role2' +GRANT USAGE ON *.* TO 'test_role1' +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role2 TO 'test_role1' +select * from mysql.roles_mapping where Host=''; +Host User Role Admin_option + test_role1 test_role2 N +show grants; +Grants for test_user@localhost +GRANT SELECT ON *.* TO 'test_role2' +GRANT USAGE ON *.* TO 'test_role1' +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role2 TO 'test_role1' +set role none; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NULL +show grants; +Grants for test_user@localhost +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +select * from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +show grants; +Grants for test_user@localhost +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +set role test_role2; +ERROR OP000: Invalid role specification `test_role2`. +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NULL +show grants; +Grants for test_user@localhost +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +select * from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +show grants; +Grants for test_user@localhost +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +set role test_role1; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role1 +show grants; +Grants for test_user@localhost +GRANT SELECT ON *.* TO 'test_role2' +GRANT USAGE ON *.* TO 'test_role1' +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role2 TO 'test_role1' +select * from mysql.roles_mapping where Host=''; +Host User Role Admin_option + test_role1 test_role2 N +show grants; +Grants for test_user@localhost +GRANT SELECT ON *.* TO 'test_role2' +GRANT USAGE ON *.* TO 'test_role1' +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role2 TO 'test_role1' +set role none; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NULL +show grants; +Grants for test_user@localhost +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +select * from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +delete from mysql.user where user='test_role1'; +delete from mysql.user where user='test_role2'; +delete from mysql.roles_mapping; +flush privileges; +drop user 'test_user'@'localhost'; diff --git a/mysql-test/suite/roles/set_role-recursive.test b/mysql-test/suite/roles/set_role-recursive.test new file mode 100644 index 00000000000..23d623e1966 --- /dev/null +++ b/mysql-test/suite/roles/set_role-recursive.test @@ -0,0 +1,79 @@ +source include/not_embedded.inc; + +#create a user with no privileges +create user test_user@localhost; +create role test_role1; +grant test_role1 to test_user@localhost; +create role test_role2; +grant test_role2 to test_role1; + +--sorted_result +select user, host from mysql.user where user not like 'root'; +--sorted_result +select * from mysql.roles_mapping where User like 'test_user'; +--sorted_result +select * from mysql.roles_mapping where User like 'test_role1'; +grant select on *.* to test_role2; +--sorted_result +select * from mysql.user where user like 'test_role1'; +--sorted_result +select * from mysql.user where user like 'test_role2'; + +change_user 'test_user'; + +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysql.roles_mapping; + +--sorted_result +show grants; +select current_user(), current_role(); +set role test_role1; +select current_user(), current_role(); +--sorted_result +show grants; +select * from mysql.roles_mapping where Host=''; + +--sorted_result +show grants; +set role none; +select current_user(), current_role(); +--sorted_result +show grants; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysql.roles_mapping; + +--sorted_result +show grants; +--error ER_INVALID_ROLE +set role test_role2; +select current_user(), current_role(); +--sorted_result +show grants; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysql.roles_mapping; + +#Make sure that this still works after an ER_INVALID_ROLE error +--sorted_result +show grants; +set role test_role1; +select current_user(), current_role(); +--sorted_result +show grants; +--sorted_result +select * from mysql.roles_mapping where Host=''; + +--sorted_result +show grants; +set role none; +select current_user(), current_role(); +--sorted_result +show grants; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysql.roles_mapping; + +change_user 'root'; +delete from mysql.user where user='test_role1'; +delete from mysql.user where user='test_role2'; +delete from mysql.roles_mapping; +flush privileges; +drop user 'test_user'@'localhost'; diff --git a/mysql-test/suite/roles/set_role-routine-simple.result b/mysql-test/suite/roles/set_role-routine-simple.result new file mode 100644 index 00000000000..3e17a78ad77 --- /dev/null +++ b/mysql-test/suite/roles/set_role-routine-simple.result @@ -0,0 +1,103 @@ +create user 'test_user'@'localhost'; +create role test_role1; +create role test_role2; +create role test_role3; +grant test_role1 to test_user@localhost; +grant test_role3 to test_user@localhost; +grant test_role2 to test_role1; +select user, host from mysql.user where user not like 'root'; +user host +test_role1 +test_role2 +test_role3 +test_user localhost +select * from mysql.roles_mapping; +Host User Role Admin_option + test_role1 test_role2 N +localhost root test_role1 Y +localhost root test_role2 Y +localhost root test_role3 Y +localhost test_user test_role1 N +localhost test_user test_role3 N +create function mysql.test_func (s CHAR(20)) +returns CHAR(50) DETERMINISTIC +return concat('Test string: ',s); +create procedure mysql.test_proc (OUT param1 INT) +begin +select COUNT(*) into param1 from mysql.roles_mapping; +end| +grant execute on function mysql.test_func to test_role2; +grant execute on procedure mysql.test_proc to test_role2; +grant execute on mysql.* to test_role3; +show grants; +Grants for test_user@localhost +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role3 TO 'test_user'@'localhost' +use mysql; +ERROR 42000: Access denied for user 'test_user'@'localhost' to database 'mysql' +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NULL +set role test_role1; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role1 +use mysql; +call test_proc(@a); +SELECT @a; +@a +6 +SELECT test_func('AABBCCDD'); +test_func('AABBCCDD') +Test string: AABBCCDD +show grants; +Grants for test_user@localhost +GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO 'test_role2' +GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO 'test_role2' +GRANT USAGE ON *.* TO 'test_role1' +GRANT USAGE ON *.* TO 'test_role2' +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role2 TO 'test_role1' +GRANT test_role3 TO 'test_user'@'localhost' +set role none; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NULL +show grants; +Grants for test_user@localhost +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role3 TO 'test_user'@'localhost' +call test_proc(@a); +ERROR 42000: execute command denied to user 'test_user'@'localhost' for routine 'mysql.test_proc' +SELECT test_func('AABBCCDD'); +ERROR 42000: execute command denied to user 'test_user'@'localhost' for routine 'mysql.test_func' +set role test_role3; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role3 +show grants; +Grants for test_user@localhost +GRANT EXECUTE ON `mysql`.* TO 'test_role3' +GRANT USAGE ON *.* TO 'test_role3' +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role3 TO 'test_user'@'localhost' +call test_proc(@a); +SELECT @a; +@a +6 +SELECT test_func('AABBCCDD'); +test_func('AABBCCDD') +Test string: AABBCCDD +drop user 'test_user'@'localhost'; +revoke execute on function mysql.test_func from test_role2; +revoke execute on procedure mysql.test_proc from test_role2; +revoke execute on mysql.* from test_role3; +delete from mysql.user where user like'test_%'; +delete from mysql.roles_mapping where Role like 'test%'; +drop function mysql.test_func; +drop procedure mysql.test_proc; +flush privileges; diff --git a/mysql-test/suite/roles/set_role-routine-simple.test b/mysql-test/suite/roles/set_role-routine-simple.test new file mode 100644 index 00000000000..0e808d190d6 --- /dev/null +++ b/mysql-test/suite/roles/set_role-routine-simple.test @@ -0,0 +1,81 @@ +source include/not_embedded.inc; + +create user 'test_user'@'localhost'; +create role test_role1; +create role test_role2; +create role test_role3; + +grant test_role1 to test_user@localhost; +grant test_role3 to test_user@localhost; +grant test_role2 to test_role1; + +--sorted_result +select user, host from mysql.user where user not like 'root'; +--sorted_result +select * from mysql.roles_mapping; + +create function mysql.test_func (s CHAR(20)) +returns CHAR(50) DETERMINISTIC +return concat('Test string: ',s); + + +delimiter |; +create procedure mysql.test_proc (OUT param1 INT) +begin + select COUNT(*) into param1 from mysql.roles_mapping; +end| +delimiter ;| + +grant execute on function mysql.test_func to test_role2; +grant execute on procedure mysql.test_proc to test_role2; + +grant execute on mysql.* to test_role3; + +change_user 'test_user'; +--sorted_result +show grants; + +--error ER_DBACCESS_DENIED_ERROR +use mysql; +select current_user(), current_role(); +set role test_role1; +select current_user(), current_role(); +use mysql; + +call test_proc(@a); +SELECT @a; + +SELECT test_func('AABBCCDD'); + +--sorted_result +show grants; +set role none; +select current_user(), current_role(); +--sorted_result +show grants; + +--error ER_PROCACCESS_DENIED_ERROR +call test_proc(@a); + +--error ER_PROCACCESS_DENIED_ERROR +SELECT test_func('AABBCCDD'); + +set role test_role3; +select current_user(), current_role(); +--sorted_result +show grants; +call test_proc(@a); +SELECT @a; + +SELECT test_func('AABBCCDD'); + +change_user 'root'; +drop user 'test_user'@'localhost'; +revoke execute on function mysql.test_func from test_role2; +revoke execute on procedure mysql.test_proc from test_role2; +revoke execute on mysql.* from test_role3; +delete from mysql.user where user like'test_%'; +delete from mysql.roles_mapping where Role like 'test%'; +drop function mysql.test_func; +drop procedure mysql.test_proc; +flush privileges; diff --git a/mysql-test/suite/roles/set_role-simple.result b/mysql-test/suite/roles/set_role-simple.result new file mode 100644 index 00000000000..ea416835017 --- /dev/null +++ b/mysql-test/suite/roles/set_role-simple.result @@ -0,0 +1,47 @@ +create user test_user@localhost; +create role test_role1; +grant test_role1 to test_user@localhost; +select user, host from mysql.user where user not like 'root'; +user host +test_role1 +test_user localhost +select * from mysql.roles_mapping; +Host User Role Admin_option +localhost root test_role1 Y +localhost test_user test_role1 N +grant select on *.* to test_role1; +select * from mysql.user where user='test_role1'; +Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role + test_role1 Y N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 N Y +select * from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +show grants; +Grants for test_user@localhost +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NULL +set role test_role1; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role1 +show grants; +Grants for test_user@localhost +GRANT SELECT ON *.* TO 'test_role1' +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +select * from mysql.roles_mapping; +Host User Role Admin_option +localhost root test_role1 Y +localhost test_user test_role1 N +set role none; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NULL +select * from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +delete from mysql.user where user='test_role1'; +delete from mysql.roles_mapping where Role='test_role1'; +flush privileges; +drop user 'test_user'@'localhost'; diff --git a/mysql-test/suite/roles/set_role-simple.test b/mysql-test/suite/roles/set_role-simple.test new file mode 100644 index 00000000000..152a1d0eb25 --- /dev/null +++ b/mysql-test/suite/roles/set_role-simple.test @@ -0,0 +1,39 @@ +source include/not_embedded.inc; + +#create a user with no privileges +create user test_user@localhost; +create role test_role1; +grant test_role1 to test_user@localhost; +--sorted_result +select user, host from mysql.user where user not like 'root'; +--sorted_result +select * from mysql.roles_mapping; +grant select on *.* to test_role1; +--sorted_result +select * from mysql.user where user='test_role1'; + +change_user 'test_user'; + +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysql.roles_mapping; + +--sorted_result +show grants; +select current_user(), current_role(); +set role test_role1; +select current_user(), current_role(); +--sorted_result +show grants; +--sorted_result +select * from mysql.roles_mapping; + +set role none; +select current_user(), current_role(); +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysql.roles_mapping; + +change_user 'root'; +delete from mysql.user where user='test_role1'; +delete from mysql.roles_mapping where Role='test_role1'; +flush privileges; +drop user 'test_user'@'localhost'; diff --git a/mysql-test/suite/roles/set_role-table-column-priv.result b/mysql-test/suite/roles/set_role-table-column-priv.result new file mode 100644 index 00000000000..721bd3039a3 --- /dev/null +++ b/mysql-test/suite/roles/set_role-table-column-priv.result @@ -0,0 +1,69 @@ +create user test_user@localhost; +create role test_role1; +create role test_role2; +grant test_role1 to test_user@localhost; +grant test_role2 to test_role1; +select user, host from mysql.user where user not like 'root'; +user host +test_role1 +test_role2 +test_user localhost +select * from mysql.roles_mapping; +Host User Role Admin_option + test_role1 test_role2 N +localhost root test_role1 Y +localhost root test_role2 Y +localhost test_user test_role1 N +grant select (Role) on mysql.roles_mapping to test_role2; +select * from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +show grants; +Grants for test_user@localhost +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NULL +set role test_role1; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role1 +show grants; +Grants for test_user@localhost +GRANT SELECT (Role) ON `mysql`.`roles_mapping` TO 'test_role2' +GRANT USAGE ON *.* TO 'test_role1' +GRANT USAGE ON *.* TO 'test_role2' +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role2 TO 'test_role1' +select * from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for column 'Host' in table 'roles_mapping' +select Role from mysql.roles_mapping; +Role +test_role1 +test_role1 +test_role2 +test_role2 +show grants; +Grants for test_user@localhost +GRANT SELECT (Role) ON `mysql`.`roles_mapping` TO 'test_role2' +GRANT USAGE ON *.* TO 'test_role1' +GRANT USAGE ON *.* TO 'test_role2' +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role2 TO 'test_role1' +use mysql; +set role none; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NULL +select Role from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +drop user 'test_user'@'localhost'; +select * from mysql.tables_priv; +Host Db User Table_name Grantor Timestamp Table_priv Column_priv + mysql test_role2 roles_mapping root@localhost 0000-00-00 00:00:00 Select +revoke select on mysql.roles_mapping from test_role2; +delete from mysql.user where user like'test_%'; +delete from mysql.roles_mapping where Role like 'test%'; +flush privileges; diff --git a/mysql-test/suite/roles/set_role-table-column-priv.test b/mysql-test/suite/roles/set_role-table-column-priv.test new file mode 100644 index 00000000000..e154b259b04 --- /dev/null +++ b/mysql-test/suite/roles/set_role-table-column-priv.test @@ -0,0 +1,56 @@ +source include/not_embedded.inc; + +create user test_user@localhost; +create role test_role1; +create role test_role2; + +grant test_role1 to test_user@localhost; +grant test_role2 to test_role1; +--sorted_result +select user, host from mysql.user where user not like 'root'; +--sorted_result +select * from mysql.roles_mapping; + +grant select (Role) on mysql.roles_mapping to test_role2; + +change_user 'test_user'; + +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysql.roles_mapping; + +--sorted_result +show grants; + +select current_user(), current_role(); +set role test_role1; +select current_user(), current_role(); + +--sorted_result +show grants; + +--error ER_COLUMNACCESS_DENIED_ERROR +select * from mysql.roles_mapping; + +--sorted_result +select Role from mysql.roles_mapping; + +--sorted_result +show grants; + +use mysql; + +set role none; +select current_user(), current_role(); + +--sorted_result +--error ER_TABLEACCESS_DENIED_ERROR +select Role from mysql.roles_mapping; + +change_user 'root'; +drop user 'test_user'@'localhost'; +select * from mysql.tables_priv; +revoke select on mysql.roles_mapping from test_role2; +delete from mysql.user where user like'test_%'; +delete from mysql.roles_mapping where Role like 'test%'; + +flush privileges; diff --git a/mysql-test/suite/roles/set_role-table-simple.result b/mysql-test/suite/roles/set_role-table-simple.result new file mode 100644 index 00000000000..f5688dbe62e --- /dev/null +++ b/mysql-test/suite/roles/set_role-table-simple.result @@ -0,0 +1,67 @@ +create user test_user@localhost; +create role test_role1; +create role test_role2; +grant test_role1 to test_user@localhost; +grant test_role2 to test_role1; +select user, host from mysql.user where user not like 'root'; +user host +test_role1 +test_role2 +test_user localhost +select * from mysql.roles_mapping; +Host User Role Admin_option + test_role1 test_role2 N +localhost root test_role1 Y +localhost root test_role2 Y +localhost test_user test_role1 N +grant select on mysql.roles_mapping to test_role2; +select * from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +show grants; +Grants for test_user@localhost +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NULL +set role test_role1; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role1 +show grants; +Grants for test_user@localhost +GRANT SELECT ON `mysql`.`roles_mapping` TO 'test_role2' +GRANT USAGE ON *.* TO 'test_role1' +GRANT USAGE ON *.* TO 'test_role2' +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role2 TO 'test_role1' +select * from mysql.roles_mapping; +Host User Role Admin_option + test_role1 test_role2 N +localhost root test_role1 Y +localhost root test_role2 Y +localhost test_user test_role1 N +show grants; +Grants for test_user@localhost +GRANT SELECT ON `mysql`.`roles_mapping` TO 'test_role2' +GRANT USAGE ON *.* TO 'test_role1' +GRANT USAGE ON *.* TO 'test_role2' +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role2 TO 'test_role1' +use mysql; +set role none; +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NULL +select * from mysql.roles_mapping; +ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping' +drop user 'test_user'@'localhost'; +select * from mysql.tables_priv; +Host Db User Table_name Grantor Timestamp Table_priv Column_priv + mysql test_role2 roles_mapping root@localhost 0000-00-00 00:00:00 Select +revoke select on mysql.roles_mapping from test_role2; +delete from mysql.user where user like'test_%'; +delete from mysql.roles_mapping where Role like 'test%'; +flush privileges; diff --git a/mysql-test/suite/roles/set_role-table-simple.test b/mysql-test/suite/roles/set_role-table-simple.test new file mode 100644 index 00000000000..8de7781927a --- /dev/null +++ b/mysql-test/suite/roles/set_role-table-simple.test @@ -0,0 +1,53 @@ +source include/not_embedded.inc; + +create user test_user@localhost; +create role test_role1; +create role test_role2; + +grant test_role1 to test_user@localhost; +grant test_role2 to test_role1; +--sorted_result +select user, host from mysql.user where user not like 'root'; +--sorted_result +select * from mysql.roles_mapping; + +grant select on mysql.roles_mapping to test_role2; + +change_user 'test_user'; + +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysql.roles_mapping; + +--sorted_result +show grants; + +select current_user(), current_role(); +set role test_role1; +select current_user(), current_role(); + +--sorted_result +show grants; + +--sorted_result +select * from mysql.roles_mapping; + +--sorted_result +show grants; + +use mysql; + +set role none; +select current_user(), current_role(); + +--sorted_result +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysql.roles_mapping; + +change_user 'root'; +drop user 'test_user'@'localhost'; +select * from mysql.tables_priv; +revoke select on mysql.roles_mapping from test_role2; +delete from mysql.user where user like'test_%'; +delete from mysql.roles_mapping where Role like 'test%'; + +flush privileges; diff --git a/mysql-test/suite/roles/show_grants.result b/mysql-test/suite/roles/show_grants.result new file mode 100644 index 00000000000..e7b7860c74f --- /dev/null +++ b/mysql-test/suite/roles/show_grants.result @@ -0,0 +1,148 @@ +create user test_user@localhost; +create role test_role1; +create role test_role2; +grant test_role1 to test_user@localhost; +grant test_role2 to test_user@localhost; +grant test_role2 to test_role1; +select user, host from mysql.user where user not like 'root'; +user host +test_role1 +test_role2 +test_user localhost +select * from mysql.roles_mapping; +Host User Role Admin_option + test_role1 test_role2 N +localhost root test_role1 Y +localhost root test_role2 Y +localhost test_user test_role1 N +localhost test_user test_role2 N +select user, host from mysql.db; +user host + % + % +grant select on mysql.* to test_role2; +flush privileges; +select * from information_schema.applicable_roles; +GRANTEE ROLE_NAME IS_GRANTABLE +root@localhost test_role1 YES +root@localhost test_role2 YES +test_role1 test_role2 NO +select * from information_schema.applicable_roles; +GRANTEE ROLE_NAME IS_GRANTABLE +test_role1 test_role2 NO +test_user@localhost test_role1 NO +test_user@localhost test_role2 NO +show grants; +Grants for test_user@localhost +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role2 TO 'test_user'@'localhost' +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NULL +set role test_role1; +select * from information_schema.enabled_roles; +ROLE_NAME +test_role1 +test_role2 +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role1 +show grants; +Grants for test_user@localhost +GRANT SELECT ON `mysql`.* TO 'test_role2' +GRANT USAGE ON *.* TO 'test_role1' +GRANT USAGE ON *.* TO 'test_role2' +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role2 TO 'test_role1' +GRANT test_role2 TO 'test_user'@'localhost' +set role none; +select * from information_schema.enabled_roles; +ROLE_NAME +NULL +select current_user(), current_role(); +current_user() current_role() +test_user@localhost NULL +show grants; +Grants for test_user@localhost +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role2 TO 'test_user'@'localhost' +show grants for test_user@localhost; +Grants for test_user@localhost +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role2 TO 'test_user'@'localhost' +show grants for test_role1; +ERROR 42000: Access denied for user 'test_user'@'localhost' to database 'mysql' +show grants for test_role2; +ERROR 42000: Access denied for user 'test_user'@'localhost' to database 'mysql' +show grants for CURRENT_USER; +Grants for test_user@localhost +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role2 TO 'test_user'@'localhost' +show grants for CURRENT_USER(); +Grants for test_user@localhost +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role2 TO 'test_user'@'localhost' +show grants for CURRENT_ROLE; +ERROR 42000: There is no such grant defined for user 'test_user' on host 'localhost' +show grants for CURRENT_ROLE(); +ERROR 42000: There is no such grant defined for user 'test_user' on host 'localhost' +set role test_role2; +select * from information_schema.enabled_roles; +ROLE_NAME +test_role2 +select current_user(), current_role(); +current_user() current_role() +test_user@localhost test_role2 +show grants; +Grants for test_user@localhost +GRANT SELECT ON `mysql`.* TO 'test_role2' +GRANT USAGE ON *.* TO 'test_role2' +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role2 TO 'test_user'@'localhost' +show grants for test_user@localhost; +Grants for test_user@localhost +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role2 TO 'test_user'@'localhost' +show grants for test_role1; +Grants for test_role1 +GRANT SELECT ON `mysql`.* TO 'test_role2' +GRANT USAGE ON *.* TO 'test_role1' +GRANT USAGE ON *.* TO 'test_role2' +GRANT test_role2 TO 'test_role1' +show grants for test_role2; +Grants for test_role2 +GRANT SELECT ON `mysql`.* TO 'test_role2' +GRANT USAGE ON *.* TO 'test_role2' +show grants for CURRENT_USER; +Grants for test_user@localhost +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role2 TO 'test_user'@'localhost' +show grants for CURRENT_USER(); +Grants for test_user@localhost +GRANT USAGE ON *.* TO 'test_user'@'localhost' +GRANT test_role1 TO 'test_user'@'localhost' +GRANT test_role2 TO 'test_user'@'localhost' +show grants for CURRENT_ROLE; +Grants for test_role2 +GRANT SELECT ON `mysql`.* TO 'test_role2' +GRANT USAGE ON *.* TO 'test_role2' +show grants for CURRENT_ROLE(); +Grants for test_role2 +GRANT SELECT ON `mysql`.* TO 'test_role2' +GRANT USAGE ON *.* TO 'test_role2' +drop user 'test_user'@'localhost'; +revoke select on mysql.* from test_role2; +drop role test_role1; +drop role test_role2; +delete from mysql.roles_mapping where Role='test_role1'; +delete from mysql.roles_mapping where Role='test_role2'; +flush privileges; diff --git a/mysql-test/suite/roles/show_grants.test b/mysql-test/suite/roles/show_grants.test new file mode 100644 index 00000000000..9c15d8b8b2b --- /dev/null +++ b/mysql-test/suite/roles/show_grants.test @@ -0,0 +1,90 @@ +source include/not_embedded.inc; + +#create a user with no privileges +create user test_user@localhost; +create role test_role1; +create role test_role2; + +grant test_role1 to test_user@localhost; +grant test_role2 to test_user@localhost; +grant test_role2 to test_role1; +--sorted_result +select user, host from mysql.user where user not like 'root'; +--sorted_result +select * from mysql.roles_mapping; + +--sorted_result +select user, host from mysql.db; + +grant select on mysql.* to test_role2; +flush privileges; + +--sorted_result +select * from information_schema.applicable_roles; + +change_user 'test_user'; + +--sorted_result +select * from information_schema.applicable_roles; + +--sorted_result +show grants; +select current_user(), current_role(); +set role test_role1; +--sorted_result +select * from information_schema.enabled_roles; +select current_user(), current_role(); +--sorted_result +show grants; +set role none; +--sorted_result +select * from information_schema.enabled_roles; +select current_user(), current_role(); +--sorted_result +show grants; + +--sorted_result +show grants for test_user@localhost; +--error ER_DBACCESS_DENIED_ERROR +show grants for test_role1; +--error ER_DBACCESS_DENIED_ERROR +show grants for test_role2; +--sorted_result +show grants for CURRENT_USER; +--sorted_result +show grants for CURRENT_USER(); +--error ER_NONEXISTING_GRANT +show grants for CURRENT_ROLE; +--error ER_NONEXISTING_GRANT +show grants for CURRENT_ROLE(); + +set role test_role2; +--sorted_result +select * from information_schema.enabled_roles; +select current_user(), current_role(); +--sorted_result +show grants; +--sorted_result +show grants for test_user@localhost; +--sorted_result +show grants for test_role1; +--sorted_result +show grants for test_role2; +--sorted_result +show grants for CURRENT_USER; +--sorted_result +show grants for CURRENT_USER(); +--sorted_result +show grants for CURRENT_ROLE; +--sorted_result +show grants for CURRENT_ROLE(); + + +change_user 'root'; +drop user 'test_user'@'localhost'; +revoke select on mysql.* from test_role2; +drop role test_role1; +drop role test_role2; +delete from mysql.roles_mapping where Role='test_role1'; +delete from mysql.roles_mapping where Role='test_role2'; +flush privileges; diff --git a/mysql-test/suite/rpl/r/rpl_do_grant.result b/mysql-test/suite/rpl/r/rpl_do_grant.result index f1e994c660b..4cbc2d7d9e9 100644 --- a/mysql-test/suite/rpl/r/rpl_do_grant.result +++ b/mysql-test/suite/rpl/r/rpl_do_grant.result @@ -190,7 +190,7 @@ GRANT EXECUTE ON PROCEDURE `test`.`p1` TO 'user49119'@'localhost' SHOW GRANTS FOR CURRENT_USER; Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION ############################################################## ############################################################## ### Showing grants for both users: root and user49119 (master) @@ -201,7 +201,7 @@ GRANT EXECUTE ON PROCEDURE `test`.`p1` TO 'user49119'@'localhost' SHOW GRANTS FOR CURRENT_USER; Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION ############################################################## ## This statement will make the revoke fail because root has no ## execute grant. However, it will still revoke the grant for @@ -217,7 +217,7 @@ GRANT USAGE ON *.* TO 'user49119'@'localhost' SHOW GRANTS FOR CURRENT_USER; Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION ############################################################## ############################################################# ### Showing grants for both users: root and user49119 (slave) @@ -228,7 +228,7 @@ GRANT USAGE ON *.* TO 'user49119'@'localhost' SHOW GRANTS FOR CURRENT_USER; Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION -GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION ############################################################## DROP TABLE t1; DROP PROCEDURE p1; diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index 20284ec9ae9..1fa4101bfe3 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -587,7 +587,6 @@ flush privileges; # Create some users with different hostnames create user mysqltest_8@''; -create user mysqltest_8; create user mysqltest_8@host8; # Try to create them again @@ -614,7 +613,6 @@ select * from t1; disconnect conn3; connection master; revoke select on mysqltest.* from mysqltest_8@''; -revoke select on mysqltest.* from mysqltest_8; show grants for mysqltest_8@''; show grants for mysqltest_8; select * from information_schema.schema_privileges @@ -642,7 +640,6 @@ select * from t1; disconnect conn4; connection master; revoke update (a) on t1 from mysqltest_8@''; -revoke update (a) on t1 from mysqltest_8; show grants for mysqltest_8@''; show grants for mysqltest_8; select * from information_schema.column_privileges; @@ -664,7 +661,6 @@ select * from t1; disconnect conn5; connection master; revoke update on t1 from mysqltest_8@''; -revoke update on t1 from mysqltest_8; show grants for mysqltest_8@''; show grants for mysqltest_8; select * from information_schema.table_privileges; @@ -692,10 +688,6 @@ show grants for mysqltest_8; drop user mysqltest_8@''; --error ER_NONEXISTING_GRANT show grants for mysqltest_8@''; -show grants for mysqltest_8; -select * from information_schema.user_privileges -where grantee like "'mysqltest_8'%"; -drop user mysqltest_8; --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --error ER_ACCESS_DENIED_ERROR connect (conn6,localhost,mysqltest_8,,); @@ -1669,7 +1661,6 @@ use test; # --echo FLUSH PRIVILEGES without procs_priv table. RENAME TABLE mysql.procs_priv TO mysql.procs_gone; ---error ER_NO_SUCH_TABLE FLUSH PRIVILEGES; --echo Assigning privileges without procs_priv table. CREATE DATABASE mysqltest1; diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test index cde3d12b0ce..8590dccd1d1 100644 --- a/mysql-test/t/grant2.test +++ b/mysql-test/t/grant2.test @@ -405,7 +405,7 @@ drop database mysqltest_1; # But anonymous users can't change their password connect (n5,localhost,test,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connection n5; ---error ER_PASSWORD_NO_MATCH +--error ER_PASSWORD_ANONYMOUS_USER set password = password("changed"); disconnect n5; connection default; diff --git a/mysql-test/t/join_cache.test b/mysql-test/t/join_cache.test index 2d06c3e2a30..7859822bcad 100644 --- a/mysql-test/t/join_cache.test +++ b/mysql-test/t/join_cache.test @@ -3636,5 +3636,49 @@ set optimizer_switch=@tmp_optimizer_switch; DROP table t1,t2,t3; +--echo # +--echo # MDEV-5123 Remove duplicated conditions pushed both to join_tab->select_cond and join_tab->cache_select->cond for blocked joins. +--echo # + +set join_cache_level=default; +set expensive_subquery_limit=0; + +create table t1 (c1 int); +create table t2 (c2 int); +create table t3 (c3 int); + +insert into t1 values (1), (2); +insert into t2 values (1), (2); +insert into t3 values (2); + +explain +select count(*) from t1 straight_join t2 +where c1 = c2-0 and c2 <= (select max(c3) from t3 where c3 = 2 and @counter:=@counter+1); + +set @counter=0; + +select count(*) from t1 straight_join t2 +where c1 = c2-0 and c2 <= (select max(c3) from t3 where c3 = 2 and @counter:=@counter+1); + +select @counter; + +explain +select count(*) from t1 straight_join t2 +where c1 = c2-0 and + c2 <= (select max(c3) from t3 where c3 = 2 and @counter:=@counter+1) and + c2 / 2 = 1; + +set @counter=0; + +select count(*) from t1 straight_join t2 +where c1 = c2-0 and + c2 <= (select max(c3) from t3 where c3 = 2 and @counter:=@counter+1) and + c2 / 2 = 1; + +select @counter; + +drop table t1,t2,t3; +set expensive_subquery_limit=default; + # this must be the last command in the file set @@optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/t/limit_rows_examined.test b/mysql-test/t/limit_rows_examined.test index ef28a37108f..45ee483c7aa 100644 --- a/mysql-test/t/limit_rows_examined.test +++ b/mysql-test/t/limit_rows_examined.test @@ -502,7 +502,7 @@ SELECT a AS field1, alias2.d AS field2, alias2.f AS field3, alias2.e AS field4, FROM t1, t2 AS alias2, t2 AS alias3 WHERE alias3.c IN ( SELECT 1 UNION SELECT 6 ) GROUP BY field1, field2, field3, field4, field5 -LIMIT ROWS EXAMINED 250; +LIMIT ROWS EXAMINED 124; SHOW STATUS LIKE 'Handler_read%'; SHOW STATUS LIKE 'Handler_tmp%'; diff --git a/mysql-test/t/plugin_auth.test b/mysql-test/t/plugin_auth.test index 366dc75c425..be07913137e 100644 --- a/mysql-test/t/plugin_auth.test +++ b/mysql-test/t/plugin_auth.test @@ -169,7 +169,7 @@ connection grant_plug_dest_con; --echo ## testing what an ordinary user can grant --echo this should fail : no rights to grant all --error ER_ACCESS_DENIED_NO_PASSWORD_ERROR -GRANT PROXY ON ''@'' TO grant_plug; +GRANT PROXY ON ''@'%%' TO grant_plug; --echo this should fail : not the same user --error ER_ACCESS_DENIED_NO_PASSWORD_ERROR @@ -212,11 +212,11 @@ disconnect grant_plug_dest_con; --echo # test what root can grant --echo should work : root has PROXY to all users -GRANT PROXY ON ''@'' TO grant_plug; -REVOKE PROXY ON ''@'' FROM grant_plug; +GRANT PROXY ON ''@'%%' TO grant_plug; +REVOKE PROXY ON ''@'%%' FROM grant_plug; --echo should work : root has PROXY to all users -GRANT PROXY ON ''@'' TO proxy_admin IDENTIFIED BY 'test' +GRANT PROXY ON ''@'%%' TO proxy_admin IDENTIFIED BY 'test' WITH GRANT OPTION; --echo need USAGE : PROXY doesn't contain it. @@ -226,7 +226,7 @@ connect (proxy_admin_con,localhost,proxy_admin,test); connection proxy_admin_con; --echo in proxy_admin_con; ---echo should work : proxy_admin has proxy to ''@'' +--echo should work : proxy_admin has proxy to ''@'%%' GRANT PROXY ON future_user TO grant_plug; connection default; @@ -318,9 +318,9 @@ DROP USER plug_dest; --echo # GRANT ALL PRIVILEGES ON *.* TO power_user; -GRANT USAGE ON anonymous_db.* TO ''@'' +GRANT USAGE ON anonymous_db.* TO ''@'%%' IDENTIFIED WITH 'test_plugin_server' AS 'power_user'; -GRANT PROXY ON power_user TO ''@''; +GRANT PROXY ON power_user TO ''@'%%'; CREATE DATABASE confidential_db; connect(plug_con,localhost, test_login_user, power_user, confidential_db); @@ -330,24 +330,23 @@ connection default; disconnect plug_con; DROP USER power_user; -DROP USER ''@''; +DROP USER ''@'%%'; DROP DATABASE confidential_db; --echo # Test case #2 (crash with double grant proxy) -CREATE USER ''@'' IDENTIFIED WITH 'test_plugin_server' AS 'standard_user'; +CREATE USER ''@'%%' IDENTIFIED WITH 'test_plugin_server' AS 'standard_user'; CREATE USER standard_user; CREATE DATABASE shared; GRANT ALL PRIVILEGES ON shared.* TO standard_user; -GRANT PROXY ON standard_user TO ''@''; +GRANT PROXY ON standard_user TO ''@'%%'; --echo #should not crash -GRANT PROXY ON standard_user TO ''@''; +GRANT PROXY ON standard_user TO ''@'%%'; -DROP USER ''@''; +DROP USER ''@'%%'; DROP USER standard_user; DROP DATABASE shared; - --echo # --echo # Bug #57551 : Live upgrade fails between 5.1.52 -> 5.5.7-rc --echo # diff --git a/mysql-test/t/plugin_auth_qa_1.test b/mysql-test/t/plugin_auth_qa_1.test index 93e471da25d..55fef4254e1 100644 --- a/mysql-test/t/plugin_auth_qa_1.test +++ b/mysql-test/t/plugin_auth_qa_1.test @@ -184,7 +184,7 @@ DROP USER new_user,new_dest,plug_dest; --echo ========== test 2, 2.1, 2.2 ================================ -CREATE USER ''@'' IDENTIFIED WITH test_plugin_server AS 'proxied_user'; +CREATE USER ''@'%%' IDENTIFIED WITH test_plugin_server AS 'proxied_user'; CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd'; --sorted_result SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; @@ -202,7 +202,7 @@ disconnect proxy_con; --error ER_ACCESS_DENIED_ERROR : this should fail : no grant connect(proxy_con,localhost,proxy_user,proxied_user); --enable_query_log -GRANT PROXY ON proxied_user TO ''@''; +GRANT PROXY ON proxied_user TO ''@'%%'; --echo connect(proxy_con,localhost,proxied_user,proxied_user_passwd); connect(proxy_con,localhost,proxied_user,proxied_user_passwd); SELECT USER(),CURRENT_USER(); @@ -219,9 +219,9 @@ SELECT @@proxy_user; connection default; --echo disconnect proxy_con; disconnect proxy_con; -DROP USER ''@'',proxied_user; +DROP USER ''@'%%',proxied_user; # -GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'' +GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'%%' IDENTIFIED WITH test_plugin_server AS 'proxied_user'; CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd'; --sorted_result @@ -239,7 +239,7 @@ disconnect proxy_con; --error ER_ACCESS_DENIED_ERROR : this should fail : no grant connect(proxy_con,localhost,proxy_user,proxied_user); --enable_query_log -GRANT PROXY ON proxied_user TO ''@''; +GRANT PROXY ON proxied_user TO ''@'%%'; --echo connect(proxy_con,localhost,proxied_user,proxied_user_passwd); connect(proxy_con,localhost,proxied_user,proxied_user_passwd); SELECT USER(),CURRENT_USER(); @@ -255,19 +255,19 @@ SELECT @@proxy_user; connection default; --echo disconnect proxy_con; disconnect proxy_con; -DROP USER ''@'',proxied_user; +DROP USER ''@'%%',proxied_user; # -CREATE USER ''@'' IDENTIFIED WITH test_plugin_server AS 'proxied_user'; +CREATE USER ''@'%%' IDENTIFIED WITH test_plugin_server AS 'proxied_user'; CREATE USER proxied_user_1 IDENTIFIED BY 'proxied_user_1_pwd'; CREATE USER proxied_user_2 IDENTIFIED BY 'proxied_user_2_pwd'; CREATE USER proxied_user_3 IDENTIFIED BY 'proxied_user_3_pwd'; CREATE USER proxied_user_4 IDENTIFIED BY 'proxied_user_4_pwd'; CREATE USER proxied_user_5 IDENTIFIED BY 'proxied_user_5_pwd'; -GRANT PROXY ON proxied_user_1 TO ''@''; -GRANT PROXY ON proxied_user_2 TO ''@''; -GRANT PROXY ON proxied_user_3 TO ''@''; -GRANT PROXY ON proxied_user_4 TO ''@''; -GRANT PROXY ON proxied_user_5 TO ''@''; +GRANT PROXY ON proxied_user_1 TO ''@'%%'; +GRANT PROXY ON proxied_user_2 TO ''@'%%'; +GRANT PROXY ON proxied_user_3 TO ''@'%%'; +GRANT PROXY ON proxied_user_4 TO ''@'%%'; +GRANT PROXY ON proxied_user_5 TO ''@'%%'; --sorted_result SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; --echo connect(proxy_con_1,localhost,proxied_user_1,'proxied_user_1_pwd'); @@ -312,7 +312,7 @@ disconnect proxy_con_3; disconnect proxy_con_4; --echo disconnect proxy_con_5; disconnect proxy_con_5; -DROP USER ''@'',proxied_user_1,proxied_user_2,proxied_user_3,proxied_user_4,proxied_user_5; +DROP USER ''@'%%',proxied_user_1,proxied_user_2,proxied_user_3,proxied_user_4,proxied_user_5; --echo ========== test 3 ========================================== diff --git a/mysql-test/t/system_mysql_db_fix40123.test b/mysql-test/t/system_mysql_db_fix40123.test index 291da0e7a70..25d977deeba 100644 --- a/mysql-test/t/system_mysql_db_fix40123.test +++ b/mysql-test/t/system_mysql_db_fix40123.test @@ -37,7 +37,7 @@ CREATE TABLE host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) bina CREATE TABLE user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges'; INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); - INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); +INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); CREATE TABLE func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions'; @@ -78,8 +78,7 @@ CREATE TABLE index_stats (db_name varchar(64) NOT NULL, table_name varchar(64) N -- disable_query_log # Drop all tables created by this test -DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, table_stats, column_stats, index_stats, - gtid_slave_pos; +DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos; -- enable_query_log diff --git a/mysql-test/t/system_mysql_db_fix50030.test b/mysql-test/t/system_mysql_db_fix50030.test index b034087bf0e..1ab6ac3c7b9 100644 --- a/mysql-test/t/system_mysql_db_fix50030.test +++ b/mysql-test/t/system_mysql_db_fix50030.test @@ -85,8 +85,8 @@ CREATE TABLE index_stats (db_name varchar(64) NOT NULL, table_name varchar(64) N -- disable_query_log # Drop all tables created by this test -DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, table_stats, column_stats, index_stats, - gtid_slave_pos; +DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos; + -- enable_query_log # check that we dropped all system tables diff --git a/mysql-test/t/system_mysql_db_fix50117.test b/mysql-test/t/system_mysql_db_fix50117.test index 915d6a85c26..2f9ba5477d0 100644 --- a/mysql-test/t/system_mysql_db_fix50117.test +++ b/mysql-test/t/system_mysql_db_fix50117.test @@ -105,8 +105,8 @@ CREATE TABLE index_stats (db_name varchar(64) NOT NULL, table_name varchar(64) N -- disable_query_log # Drop all tables created by this test -DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, table_stats, column_stats, index_stats, - gtid_slave_pos; +DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos; + -- enable_query_log # check that we dropped all system tables |