Skip to content

Commit 960a548

Browse files
committed
fix - MDEV-22313 compatiblity and a few minor fixes
1 parent 0129cbc commit 960a548

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

client/mysqldump.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4275,6 +4275,8 @@ static int dump_grants(const char *user_role)
42754275
}
42764276
while ((row= mysql_fetch_row(tableres)))
42774277
{
4278+
if (strncmp(row[0], "SET DEFAULT ROLE", sizeof("SET DEFAULT ROLE")) == 0)
4279+
continue;
42784280
fprintf(md_result_file, "%s;\n", row[0]);
42794281
}
42804282
mysql_free_result(tableres);
@@ -4314,7 +4316,7 @@ static int dump_create_user(const char *user)
43144316

43154317

43164318
/*
4317-
dump all users and roles
4319+
dump all users, roles and their grants
43184320
*/
43194321

43204322
static int dump_all_users_roles_and_grants()
@@ -4351,7 +4353,9 @@ static int dump_all_users_roles_and_grants()
43514353
if (dump_create_user(row[0]))
43524354
result= 1;
43534355
/* if roles exist, defer dumping grants until after roles created */
4354-
if (!(maria_roles_exist || mysql_roles_exist) && dump_grants(row[0]))
4356+
if (maria_roles_exist || mysql_roles_exist)
4357+
continue;
4358+
if (dump_grants(row[0]))
43554359
result= 1;
43564360
}
43574361
mysql_free_result(tableres);
@@ -4463,7 +4467,7 @@ static int dump_all_users_roles_and_grants()
44634467
"concat(QUOTE(User), '@', QUOTE(Host)) as u FROM mysql.user "
44644468
"/*M!100005 WHERE is_role='N' */"))
44654469
return 1;
4466-
if (mysql_roles_exist && mysql_roles_exist && mysql_query_with_error_report(mysql, &tableres,
4470+
if (mysql_roles_exist && mysql_query_with_error_report(mysql, &tableres,
44674471
"SELECT IF(DEFAULT_ROLE_HOST IS NULL, 'NONE', CONCAT(QUOTE(DEFAULT_ROLE_USER),"
44684472
" '@', QUOTE(DEFAULT_ROLE_HOST))) as r,"
44694473
" CONCAT(QUOTE(mu.USER),'@',QUOTE(mu.HOST)) as u "

0 commit comments

Comments
 (0)