--source include/not_embedded.inc
create user foo;
create role role1;
create role role2;
create role role3;

grant role1 to foo;
grant role2 to role1;
grant role3 to foo;


connect (foo, localhost, foo);
--sorted_result
select * from information_schema.applicable_roles;

set default role role3;
--sorted_result
select * from information_schema.applicable_roles;

set default role role1;
--sorted_result
select * from information_schema.applicable_roles;


disconnect foo;
connection default;

--sorted_result
select * from information_schema.applicable_roles;

set default role none for foo;
connect (foo, localhost, foo);
--sorted_result
select * from information_schema.applicable_roles;

disconnect foo;
connection default;

--sorted_result
select * from information_schema.applicable_roles;

set default role role1;
--sorted_result
select * from information_schema.applicable_roles;

set default role role2;
--sorted_result
select * from information_schema.applicable_roles;

set default role role3;
--sorted_result
select * from information_schema.applicable_roles;

set default role none;
--sorted_result
select * from information_schema.applicable_roles;

drop role role3;
drop role role2;
drop role role1;
drop user foo;
update mysql.global_priv set priv=json_compact(json_remove(priv, '$.default_role'));
