mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
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.
This commit is contained in:
@ -804,11 +804,17 @@ dumpRoles(PGconn *conn)
|
|||||||
buf, "ROLE", rolename);
|
buf, "ROLE", rolename);
|
||||||
|
|
||||||
fprintf(OPF, "%s", buf->data);
|
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);
|
PQclear(res);
|
||||||
|
|
||||||
fprintf(OPF, "\n\n");
|
fprintf(OPF, "\n\n");
|
||||||
|
Reference in New Issue
Block a user