aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2011-10-14 14:16:02 -0400
committerRobert Haas <rhaas@postgresql.org>2011-10-14 14:16:02 -0400
commitdea95c7a7beb5ef66ce89269dd0e84d0c26e5523 (patch)
treec5783f6b36de5919b793ce353d6a83f255c1ff53 /src
parent393e828e31a27845def4c3ff20cdfbee5cec1da9 (diff)
downloadpostgresql-dea95c7a7beb5ef66ce89269dd0e84d0c26e5523.tar.gz
postgresql-dea95c7a7beb5ef66ce89269dd0e84d0c26e5523.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_dump/pg_dumpall.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index b5f64e8d68e..0022d2d74ef 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -804,11 +804,17 @@ dumpRoles(PGconn *conn)
buf, "ROLE", rolename);
fprintf(OPF, "%s", buf->data);
-
- if (server_version >= 70300)
- dumpUserConfig(conn, rolename);
}
+ /*
+ * Dump configuration settings for roles after all roles have been dumped.
+ * We do it this way because config settings for roles could mention the
+ * names of other roles.
+ */
+ if (server_version >= 70300)
+ for (i = 0; i < PQntuples(res); i++)
+ dumpUserConfig(conn, PQgetvalue(res, i, i_rolname));
+
PQclear(res);
fprintf(OPF, "\n\n");