Skip to content

Commit 018eb02

Browse files
committed
Do not DROP default roles in pg_dumpall -c
When pulling the list of roles to drop, exclude roles whose names begin with "pg_" (as we do when we are dumping the roles out to recreate them). Also add regression tests to cover pg_dumpall -c and this specific issue. Noticed by Rushabh Lathia. Patch by me.
1 parent f5e7b2f commit 018eb02

File tree

2 files changed

+93
-2
lines changed

2 files changed

+93
-2
lines changed

src/bin/pg_dump/pg_dumpall.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,13 @@ dropRoles(PGconn *conn)
605605
int i_rolname;
606606
int i;
607607

608-
if (server_version >= 80100)
608+
if (server_version >= 90600)
609+
res = executeQuery(conn,
610+
"SELECT rolname "
611+
"FROM pg_authid "
612+
"WHERE rolname !~ '^pg_' "
613+
"ORDER BY 1");
614+
else if (server_version >= 80100)
609615
res = executeQuery(conn,
610616
"SELECT rolname "
611617
"FROM pg_authid "

0 commit comments

Comments
 (0)