summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/suite/roles/drop_current_role.result2
-rw-r--r--mysql-test/suite/roles/drop_current_role.test2
-rw-r--r--sql/sql_acl.cc8
3 files changed, 7 insertions, 5 deletions
diff --git a/mysql-test/suite/roles/drop_current_role.result b/mysql-test/suite/roles/drop_current_role.result
index 79525a0ff50..d5eafc6c813 100644
--- a/mysql-test/suite/roles/drop_current_role.result
+++ b/mysql-test/suite/roles/drop_current_role.result
@@ -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`.
diff --git a/mysql-test/suite/roles/drop_current_role.test b/mysql-test/suite/roles/drop_current_role.test
index 1485b830eed..c8d6fc5d9df 100644
--- a/mysql-test/suite/roles/drop_current_role.test
+++ b/mysql-test/suite/roles/drop_current_role.test
@@ -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;
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index fee337925fc..cf0b1d87bd7 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -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;
}
/*