| 1 |
# |
| 2 |
# MDEV-5225 Server crashes on CREATE USER|ROLE CURRENT_ROLE or DROP ROLE CURRENT_ROLE |
| 3 |
# |
| 4 |
|
| 5 |
# Where CURRENT_USER/CURRENT_ROLE is explicitly allowed by the grammar |
| 6 |
# the error (if any) should be ER_CANNOT_USER |
| 7 |
# |
| 8 |
# Where it's not explicitly allowed, the error is ER_PARSE_ERROR, |
| 9 |
# because CURRENT_USER/CURRENT_ROLE are reserved words and cannot be |
| 10 |
# accepted as an identifier. |
| 11 |
# |
| 12 |
|
| 13 |
--source include/not_embedded.inc |
| 14 |
|
| 15 |
create user foo@localhost; |
| 16 |
grant create user on *.* to foo@localhost; |
| 17 |
--change_user foo |
| 18 |
|
| 19 |
--error ER_CANNOT_USER |
| 20 |
create user current_user; |
| 21 |
--error ER_CANNOT_USER |
| 22 |
create user current_role; |
| 23 |
--error ER_PARSE_ERROR |
| 24 |
create role current_user; |
| 25 |
--error ER_CANNOT_USER |
| 26 |
create role current_role; |
| 27 |
# this works |
| 28 |
drop user current_user; |
| 29 |
--error ER_PARSE_ERROR |
| 30 |
drop user current_role; |
| 31 |
--error ER_PARSE_ERROR |
| 32 |
drop role current_user; |
| 33 |
--error ER_CANNOT_USER |
| 34 |
drop role current_role; |
| 35 |
show warnings; |
| 36 |
|
| 37 |
--change_user root |
| 38 |
|
| 39 |
create role r1; |
| 40 |
grant r1 to current_user; |
| 41 |
set role r1; |
| 42 |
select current_role(); |
| 43 |
|
| 44 |
--error ER_CANNOT_USER |
| 45 |
create user current_role; |
| 46 |
--error ER_CANNOT_USER |
| 47 |
create role current_role; |
| 48 |
--error ER_PARSE_ERROR |
| 49 |
drop user current_role; |
| 50 |
drop role current_role; |
| 51 |
|