mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-31 19:06:14 +01:00 
			
		
		
		
	 78d23a3e60
			
		
	
	
	78d23a3e60
	
	
	
		
			
			when a definer for SP/view is wrong - it shold be ER_MALFORMED_DEFINER, not ER_NO_SUCH_USER when one uses current_role as a definer or grantee but there's no current role - it should be ER_INVALID_ROLE not ER_MALFORMED_DEFINER when a non-existent user is specified - it should be ER_NO_SUCH_USER, which should say "The user does not exist", not "Definer does not exist" clarify ER_CANT_CHANGE_TX_CHARACTERISTICS to say what cannot be changed
		
			
				
	
	
		
			88 lines
		
	
	
	
		
			2.4 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			88 lines
		
	
	
	
		
			2.4 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| CREATE ROLE IF NOT EXISTS role1 WITH ADMIN user1;
 | |
| Warnings:
 | |
| Note	1446	The user specified as a definer ('user1'@'%') does not exist
 | |
| SELECT * FROM mysql.roles_mapping;
 | |
| Host	User	Role	Admin_option
 | |
| %	user1	role1	Y
 | |
| DROP ROLE role1;
 | |
| CREATE OR REPLACE ROLE role1 WITH ADMIN user2;
 | |
| Warnings:
 | |
| Note	1446	The user specified as a definer ('user2'@'%') does not exist
 | |
| SELECT * FROM mysql.roles_mapping WHERE Role='role1';
 | |
| Host	User	Role	Admin_option
 | |
| %	user2	role1	Y
 | |
| CREATE OR REPLACE ROLE role1 WITH ADMIN user3;
 | |
| Warnings:
 | |
| Note	1446	The user specified as a definer ('user3'@'%') does not exist
 | |
| SELECT * FROM mysql.roles_mapping WHERE Role='role1';
 | |
| Host	User	Role	Admin_option
 | |
| %	user3	role1	Y
 | |
| CREATE ROLE IF NOT EXISTS role1 WITH ADMIN user4;
 | |
| Warnings:
 | |
| Note	1446	The user specified as a definer ('user4'@'%') does not exist
 | |
| Note	1975	Can't create role 'role1'; it already exists
 | |
| SELECT * FROM mysql.roles_mapping WHERE Role='role1';
 | |
| Host	User	Role	Admin_option
 | |
| %	user3	role1	Y
 | |
| DROP ROLE IF EXISTS role1;
 | |
| SELECT * FROM mysql.roles_mapping WHERE Role='role1';
 | |
| Host	User	Role	Admin_option
 | |
| DROP ROLE IF EXISTS role1;
 | |
| Warnings:
 | |
| Note	1976	Can't drop role 'role1'; it doesn't exist
 | |
| CREATE ROLE role_1;
 | |
| CREATE ROLE IF NOT EXISTS role_1;
 | |
| Warnings:
 | |
| Note	1975	Can't create role 'role_1'; it already exists
 | |
| CREATE OR REPLACE ROLE role_1;
 | |
| CREATE OR REPLACE ROLE IF NOT EXISTS role_1;
 | |
| ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS
 | |
| CREATE ROLE role_1;
 | |
| ERROR HY000: Operation CREATE ROLE failed for 'role_1'
 | |
| CREATE USER u1@localhost;
 | |
| REVOKE SHOW DATABASES ON *.* FROM 'u1'@'localhost';
 | |
| GRANT SHOW DATABASES ON *.* TO role_1;
 | |
| GRANT role_1 TO u1@localhost;
 | |
| connect  user_a, localhost, u1,,;
 | |
| connection user_a;
 | |
| SELECT CURRENT_USER;
 | |
| CURRENT_USER
 | |
| u1@localhost
 | |
| SHOW DATABASES;
 | |
| Database
 | |
| information_schema
 | |
| SELECT CURRENT_ROLE;
 | |
| CURRENT_ROLE
 | |
| NULL
 | |
| SET ROLE role_1;
 | |
| SELECT CURRENT_ROLE;
 | |
| CURRENT_ROLE
 | |
| role_1
 | |
| SHOW DATABASES;
 | |
| Database
 | |
| information_schema
 | |
| mtr
 | |
| mysql
 | |
| performance_schema
 | |
| sys
 | |
| test
 | |
| SET ROLE NONE;
 | |
| connect  user_b, localhost, root,,;
 | |
| connection user_b;
 | |
| # Clearing up
 | |
| DROP ROLE role_1;
 | |
| DROP ROLE IF EXISTS role_1;
 | |
| Warnings:
 | |
| Note	1976	Can't drop role 'role_1'; it doesn't exist
 | |
| DROP ROLE role_1;
 | |
| ERROR HY000: Operation DROP ROLE failed for 'role_1'
 | |
| DROP USER u1@localhost;
 | |
| CREATE ROLE r;
 | |
| GRANT SHOW DATABASES ON *.* TO r;
 | |
| CREATE USER foo;
 | |
| CREATE USER bar;
 | |
| GRANT r TO foo;
 | |
| CREATE OR REPLACE USER foo IDENTIFIED WITH non_existing_plugin;
 | |
| ERROR HY000: Plugin 'non_existing_plugin' is not loaded
 | |
| DROP ROLE r;
 | |
| DROP USER bar;
 |