ClickHouse/tests/queries/0_stateless/01293_create_role.sql

77 lines
2.8 KiB
MySQL
Raw Normal View History

2023-08-07 17:35:35 +00:00
-- Tags: no-parallel
2020-06-01 21:43:16 +00:00
DROP ROLE IF EXISTS r1_01293, r2_01293, r3_01293, r4_01293, r5_01293, r6_01293, r7_01293, r8_01293, r9_01293;
DROP ROLE IF EXISTS r2_01293_renamed;
DROP ROLE IF EXISTS r1_01293@'%', 'r2_01293@%.myhost.com';
SELECT '-- default';
CREATE ROLE r1_01293;
SHOW CREATE ROLE r1_01293;
SELECT '-- same as default';
CREATE ROLE r2_01293 SETTINGS NONE;
SHOW CREATE ROLE r2_01293;
SELECT '-- rename';
ALTER ROLE r2_01293 RENAME TO 'r2_01293_renamed';
SHOW CREATE ROLE r2_01293; -- { serverError UNKNOWN_ROLE } -- Role not found
2020-06-01 21:43:16 +00:00
SHOW CREATE ROLE r2_01293_renamed;
DROP ROLE r1_01293, r2_01293_renamed;
SELECT '-- host after @';
CREATE ROLE r1_01293@'%';
CREATE ROLE r2_01293@'%.myhost.com';
SHOW CREATE ROLE r1_01293@'%';
SHOW CREATE ROLE r1_01293;
SHOW CREATE ROLE r2_01293@'%.myhost.com';
SHOW CREATE ROLE 'r2_01293@%.myhost.com';
DROP ROLE r1_01293@'%', 'r2_01293@%.myhost.com';
SELECT '-- settings';
CREATE ROLE r1_01293 SETTINGS NONE;
CREATE ROLE r2_01293 SETTINGS PROFILE 'default';
CREATE ROLE r3_01293 SETTINGS max_memory_usage=5000000;
CREATE ROLE r4_01293 SETTINGS max_memory_usage MIN=5000000;
CREATE ROLE r5_01293 SETTINGS max_memory_usage MAX=5000000;
2022-09-12 22:12:40 +00:00
CREATE ROLE r6_01293 SETTINGS max_memory_usage CONST;
2020-06-01 21:43:16 +00:00
CREATE ROLE r7_01293 SETTINGS max_memory_usage WRITABLE;
2022-09-12 22:12:40 +00:00
CREATE ROLE r8_01293 SETTINGS max_memory_usage=5000000 MIN 4000000 MAX 6000000 CONST;
2020-06-01 21:43:16 +00:00
CREATE ROLE r9_01293 SETTINGS PROFILE 'default', max_memory_usage=5000000 WRITABLE;
SHOW CREATE ROLE r1_01293;
SHOW CREATE ROLE r2_01293;
SHOW CREATE ROLE r3_01293;
SHOW CREATE ROLE r4_01293;
SHOW CREATE ROLE r5_01293;
SHOW CREATE ROLE r6_01293;
SHOW CREATE ROLE r7_01293;
SHOW CREATE ROLE r8_01293;
SHOW CREATE ROLE r9_01293;
ALTER ROLE r1_01293 SETTINGS readonly=1;
ALTER ROLE r2_01293 SETTINGS readonly=1;
ALTER ROLE r3_01293 SETTINGS NONE;
SHOW CREATE ROLE r1_01293;
SHOW CREATE ROLE r2_01293;
SHOW CREATE ROLE r3_01293;
DROP ROLE r1_01293, r2_01293, r3_01293, r4_01293, r5_01293, r6_01293, r7_01293, r8_01293, r9_01293;
SELECT '-- multiple roles in one command';
CREATE ROLE r1_01293, r2_01293;
SHOW CREATE ROLE r1_01293, r2_01293;
ALTER ROLE r1_01293, r2_01293 SETTINGS readonly=1;
SHOW CREATE ROLE r1_01293, r2_01293;
DROP ROLE r1_01293, r2_01293;
SELECT '-- system.roles';
CREATE ROLE r1_01293;
SELECT name, storage from system.roles WHERE name='r1_01293';
DROP ROLE r1_01293;
SELECT '-- system.settings_profile_elements';
CREATE ROLE r1_01293 SETTINGS readonly=1;
CREATE ROLE r2_01293 SETTINGS PROFILE 'default';
CREATE ROLE r3_01293 SETTINGS max_memory_usage=5000000 MIN 4000000 MAX 6000000 WRITABLE;
CREATE ROLE r4_01293 SETTINGS PROFILE 'default', max_memory_usage=5000000, readonly=1;
CREATE ROLE r5_01293 SETTINGS NONE;
SELECT * FROM system.settings_profile_elements WHERE role_name LIKE 'r%\_01293' ORDER BY role_name, index;
DROP ROLE r1_01293, r2_01293, r3_01293, r4_01293, r5_01293;