On master branch when we do pg_dumpall with -c option, I can see that it also dumping the "DROP ROLE pg_signal_backend", which seems wrong. Because when you restore the dump, its throwing an error "ERROR: cannot drop role pg_signal_backend because it is required by the database system".
dumpRoles()::pg_dumpall.c does have logic to not dump "CREATE ROLE" if the rolename starts with "pg_", but similar check is missing into dropRoles() function. PFA patch, to fix the problem in the similar way its been handled into dumpRoles(). Thanks, -- Rushabh Lathia www.EnterpriseDB.com
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c index 694bd1e..fe1d8ba 100644 --- a/src/bin/pg_dump/pg_dumpall.c +++ b/src/bin/pg_dump/pg_dumpall.c @@ -605,7 +605,13 @@ dropRoles(PGconn *conn) int i_rolname; int i; - if (server_version >= 80100) + if (server_version >= 90600) + res = executeQuery(conn, + "SELECT rolname " + "FROM pg_authid " + "WHERE rolname !~ '^pg_' " + "ORDER BY 1"); + else if (server_version >= 80100) res = executeQuery(conn, "SELECT rolname " "FROM pg_authid " @@ -630,6 +636,13 @@ dropRoles(PGconn *conn) rolename = PQgetvalue(res, i, i_rolname); + if (strncmp(rolename,"pg_",3) == 0) + { + fprintf(stderr, _("%s: role name starting with \"pg_\" skipped (%s)\n"), + progname, rolename); + continue; + } + fprintf(OPF, "DROP ROLE %s%s;\n", if_exists ? "IF EXISTS " : "", fmtId(rolename));
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers