Commit 018eb027 authored by Stephen Frost's avatar Stephen Frost

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.
parent f5e7b2f9
...@@ -605,7 +605,13 @@ dropRoles(PGconn *conn) ...@@ -605,7 +605,13 @@ dropRoles(PGconn *conn)
int i_rolname; int i_rolname;
int i; 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, res = executeQuery(conn,
"SELECT rolname " "SELECT rolname "
"FROM pg_authid " "FROM pg_authid "
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment