From 960a548d1e449e30ea994a7705db772bdd0e23ab Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sat, 24 Oct 2020 10:15:32 +1100 Subject: [PATCH] fix - MDEV-22313 compatiblity and a few minor fixes --- client/mysqldump.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index d199fb1edb6c7..092d675950c69 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -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); @@ -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() @@ -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); @@ -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 "