Skip to content

Commit dea95c7

Browse files
committed
Dump all roles first, then all config settings on roles.
This way, if a role's config setting uses the name of another role, the validity of the dump isn't dependent on the order in which those two roles are dumped. Code by Phil Sorber, comment by me.
1 parent 393e828 commit dea95c7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/bin/pg_dump/pg_dumpall.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -804,11 +804,17 @@ dumpRoles(PGconn *conn)
804804
buf, "ROLE", rolename);
805805

806806
fprintf(OPF, "%s", buf->data);
807-
808-
if (server_version >= 70300)
809-
dumpUserConfig(conn, rolename);
810807
}
811808

809+
/*
810+
* Dump configuration settings for roles after all roles have been dumped.
811+
* We do it this way because config settings for roles could mention the
812+
* names of other roles.
813+
*/
814+
if (server_version >= 70300)
815+
for (i = 0; i < PQntuples(res); i++)
816+
dumpUserConfig(conn, PQgetvalue(res, i, i_rolname));
817+
812818
PQclear(res);
813819

814820
fprintf(OPF, "\n\n");

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy