diff options
author | Sergei Golubchik <serg@mariadb.org> | 2020-07-30 10:07:41 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2020-07-30 23:50:56 +0200 |
commit | 09ec8e2e2246f9fb67fd41631c5669d9ae26b2e5 (patch) | |
tree | 7fad06fd6e1bfa1921d3ba305dedb63a6acf7bfe | |
parent | 4635218cb07ee15244c7a6bbcf6eeeeb7cec7fcf (diff) | |
download | mariadb-git-09ec8e2e2246f9fb67fd41631c5669d9ae26b2e5.tar.gz |
improve the error message for a dropped current role
-rw-r--r-- | mysql-test/suite/roles/drop_current_role.result | 2 | ||||
-rw-r--r-- | mysql-test/suite/roles/drop_current_role.test | 2 | ||||
-rw-r--r-- | sql/sql_acl.cc | 8 |
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; } /* |