Commit 3fa2cb21 authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru Committed by Sergei Golubchik

Updated error message in case the user table's format is not up to date and can

not support roles
parent ce4851c3
use mysql;
alter table user drop column is_role;
flush privileges;
create role test_role;
ERROR HY000: Column count of mysql.user is wrong. Expected 43, found 42. Created with MariaDB 100003, now running 100003. Please use mysql_upgrade to fix this error.
drop role test_role;
ERROR HY000: Operation DROP ROLE failed for 'test_role'
alter table user add column is_role enum('N', 'Y') default 'N' not null
COLLATE utf8_general_ci
after authentication_string;
update user set is_role='N';
flush privileges;
create role test_role;
drop role test_role;
connect (mysql, localhost, root,,);
use mysql;
alter table user drop column is_role;
flush privileges;
--error ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE
create role test_role;
--error ER_CANNOT_USER
drop role test_role;
alter table user add column is_role enum('N', 'Y') default 'N' not null
COLLATE utf8_general_ci
after authentication_string;
update user set is_role='N';
flush privileges;
create role test_role;
drop role test_role;
...@@ -3128,7 +3128,9 @@ static int replace_user_table(THD *thd, TABLE *table, LEX_USER &combo, ...@@ -3128,7 +3128,9 @@ static int replace_user_table(THD *thd, TABLE *table, LEX_USER &combo,
/* if the user table is not up to date, we can't handle role updates */ /* if the user table is not up to date, we can't handle role updates */
if (table->s->fields <= 42 && handle_as_role) if (table->s->fields <= 42 && handle_as_role)
{ {
my_error(ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE, MYF(0)); my_error(ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE, MYF(0), table->alias.c_ptr(),
43, table->s->fields,
static_cast<int>(table->s->mysql_version), MYSQL_VERSION_ID);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment