aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_dump/pg_dumpall.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 77dfbc282f7..aa4fcbb2b3c 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -502,7 +502,7 @@ main(int argc, char *argv[])
}
/* Dump CREATE DATABASE commands */
- if (!globals_only && !roles_only && !tablespaces_only)
+ if (binary_upgrade || (!globals_only && !roles_only && !tablespaces_only))
dumpCreateDB(conn);
/* Dump role/database settings */
@@ -745,9 +745,11 @@ dumpRoles(PGconn *conn)
* will acquire the right properties even if it already exists (ie, it
* won't hurt for the CREATE to fail). This is particularly important
* for the role we are connected as, since even with --clean we will
- * have failed to drop it.
+ * have failed to drop it. binary_upgrade cannot generate any errors,
+ * so we assume the role is already created.
*/
- appendPQExpBuffer(buf, "CREATE ROLE %s;\n", fmtId(rolename));
+ if (!binary_upgrade)
+ appendPQExpBuffer(buf, "CREATE ROLE %s;\n", fmtId(rolename));
appendPQExpBuffer(buf, "ALTER ROLE %s WITH", fmtId(rolename));
if (strcmp(PQgetvalue(res, i, i_rolsuper), "t") == 0)