improve the error message for a dropped current role

This commit is contained in:
Sergei Golubchik 2020-07-30 10:07:41 +02:00
parent 4635218cb0
commit 09ec8e2e22
3 changed files with 7 additions and 5 deletions

View File

@ -2,4 +2,4 @@ create role r;
set role r;
drop role r;
revoke all on *.* from current_role;
ERROR 42000: There is no such grant defined for user 'r' on host ''
ERROR OP000: Invalid role specification `r`.

View File

@ -5,5 +5,5 @@
create role r;
set role r;
drop role r;
error ER_NONEXISTING_GRANT;
error ER_INVALID_ROLE;
revoke all on *.* from current_role;

View File

@ -3475,13 +3475,15 @@ static int replace_user_table(THD *thd, TABLE *table, LEX_USER &combo,
table->key_info->key_length);
if (table->file->ha_index_read_idx_map(table->record[0], 0, user_key,
HA_WHOLE_KEY,
HA_READ_KEY_EXACT))
HA_WHOLE_KEY, HA_READ_KEY_EXACT))
{
/* what == 'N' means revoke */
if (what == 'N')
{
my_error(ER_NONEXISTING_GRANT, MYF(0), combo.user.str, combo.host.str);
if (combo.host.length)
my_error(ER_NONEXISTING_GRANT, MYF(0), combo.user.str, combo.host.str);
else
my_error(ER_INVALID_ROLE, MYF(0), combo.user.str);
goto end;
}
/*