Skip to content

Commit

Permalink
fix - MDEV-22313 compatiblity and a few minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
grooverdan committed Oct 23, 2020
1 parent 0129cbc commit 960a548
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions client/mysqldump.c
Original file line number Diff line number Diff line change
Expand Up @@ -4275,6 +4275,8 @@ static int dump_grants(const char *user_role)
}
while ((row= mysql_fetch_row(tableres)))
{
if (strncmp(row[0], "SET DEFAULT ROLE", sizeof("SET DEFAULT ROLE")) == 0)
continue;
fprintf(md_result_file, "%s;\n", row[0]);
}
mysql_free_result(tableres);
Expand Down Expand Up @@ -4314,7 +4316,7 @@ static int dump_create_user(const char *user)


/*
dump all users and roles
dump all users, roles and their grants
*/

static int dump_all_users_roles_and_grants()
Expand Down Expand Up @@ -4351,7 +4353,9 @@ static int dump_all_users_roles_and_grants()
if (dump_create_user(row[0]))
result= 1;
/* if roles exist, defer dumping grants until after roles created */
if (!(maria_roles_exist || mysql_roles_exist) && dump_grants(row[0]))
if (maria_roles_exist || mysql_roles_exist)
continue;
if (dump_grants(row[0]))
result= 1;
}
mysql_free_result(tableres);
Expand Down Expand Up @@ -4463,7 +4467,7 @@ static int dump_all_users_roles_and_grants()
"concat(QUOTE(User), '@', QUOTE(Host)) as u FROM mysql.user "
"/*M!100005 WHERE is_role='N' */"))
return 1;
if (mysql_roles_exist && mysql_roles_exist && mysql_query_with_error_report(mysql, &tableres,
if (mysql_roles_exist && mysql_query_with_error_report(mysql, &tableres,
"SELECT IF(DEFAULT_ROLE_HOST IS NULL, 'NONE', CONCAT(QUOTE(DEFAULT_ROLE_USER),"
" '@', QUOTE(DEFAULT_ROLE_HOST))) as r,"
" CONCAT(QUOTE(mu.USER),'@',QUOTE(mu.HOST)) as u "
Expand Down

0 comments on commit 960a548

Please sign in to comment.