mariadb/mysql-test/main/set_authorization.result
Sergei Golubchik 097f1f269e MDEV-20299 SET SESSION AUTHORIZATION
a.k.a. "sudo"
2025-03-18 18:27:26 +01:00

82 lines
2.8 KiB
Text

#
# MDEV-20299 SET SESSION AUTHORIZATION
#
create user foo@bar identified via mysql_native_password using password('foo');
connect con1, localhost, root;
select user(), current_user(), database();
user() current_user() database()
root@localhost root@localhost test
set session authorization bar@foo;
ERROR HY000: The user 'bar'@'foo' does not exist
select user(), current_user(), database();
user() current_user() database()
root@localhost root@localhost test
set session authorization foo@bar;
select user(), current_user(), database();
user() current_user() database()
foo@bar foo@bar NULL
set @a:='not changed';
set session authorization bar@foo;
ERROR 28000: Access denied trying to change to user 'bar'@'foo'
select @a;
@a
not changed
set session authorization foo@bar;
select @a;
@a
NULL
disconnect con1;
connection default;
drop user foo@bar;
create user ''@'l%t' identified via mysql_native_password using password('foo');
connect con1, localhost, root;
select user(), current_user(), database();
user() current_user() database()
root@localhost root@localhost test
set session authorization fist@list;
select user(), current_user(), database();
user() current_user() database()
fist@list @l%t NULL
set @a:='not changed';
set session authorization first@last;
ERROR 28000: Access denied trying to change to user 'first'@'last'
select @a;
@a
not changed
set session authorization fist@list;
select @a;
@a
NULL
disconnect con1;
connection default;
drop user ''@'l%t';
create user ''@'%' identified via mysql_native_password using password('foo');
connect con1, localhost, root;
select user(), current_user(), database();
user() current_user() database()
root@localhost root@localhost test
set session authorization ''@last;
ERROR HY000: The user ''@'last' does not exist
set session authorization foo@'';
ERROR HY000: The user 'foo'@'' does not exist
start transaction;
select user(), current_user(), database(), @@in_transaction;
user() current_user() database() @@in_transaction
root@localhost root@localhost test 1
set session authorization foo@bar;
ERROR 25001: SESSION AUTHORIZATION can't be set while a transaction is in progress
select user(), current_user(), database(), @@in_transaction;
user() current_user() database() @@in_transaction
root@localhost root@localhost test 1
disconnect con1;
connection default;
prepare s from 'set session authorization foo@bar';
ERROR HY000: This command is not supported in the prepared statement protocol yet
create procedure sudo_foobar() set session authorization foo@bar;
ERROR 0A000: SET SESSION AUTHORIZATION is not allowed in stored procedures
create procedure sudo_foobar()
execute immediate 'set session authorization foo@bar';
call sudo_foobar();
ERROR HY000: This command is not supported in the prepared statement protocol yet
drop procedure sudo_foobar;
drop user ''@'%';