aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2022-02-17 10:53:51 -0500
committerRobert Haas <rhaas@postgresql.org>2022-02-17 10:53:51 -0500
commit138c51b72168e7b57c9edb4e9935274d3abf6bed (patch)
treece9fd00bae97c2318c44013f301bf375e55abb88
parentf1ac4a74dee5ac0c89612fe2ac6e48082edbec23 (diff)
downloadpostgresql-138c51b72168e7b57c9edb4e9935274d3abf6bed.tar.gz
postgresql-138c51b72168e7b57c9edb4e9935274d3abf6bed.zip
Add missing binary-upgrade guard.
Commit 9a974cbcba005256a19991203583a94b4f9a21a9 arranged for pg_dumpall to preserve tablespace OIDs, but it should only do that in binary upgrade mode, not all the time. Reported by Christoph Berg. Discussion: http://postgr.es/m/YgjwrkEvNEqoz4Vm@msg.df7cb.de
-rw-r--r--src/bin/pg_dump/pg_dumpall.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 10383c713fe..9c9f7c6d63c 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -1066,8 +1066,11 @@ dumpTablespaces(PGconn *conn)
/* needed for buildACLCommands() */
fspcname = pg_strdup(fmtId(spcname));
- appendPQExpBufferStr(buf, "\n-- For binary upgrade, must preserve pg_tablespace oid\n");
- appendPQExpBuffer(buf, "SELECT pg_catalog.binary_upgrade_set_next_pg_tablespace_oid('%u'::pg_catalog.oid);\n", spcoid);
+ if (binary_upgrade)
+ {
+ appendPQExpBufferStr(buf, "\n-- For binary upgrade, must preserve pg_tablespace oid\n");
+ appendPQExpBuffer(buf, "SELECT pg_catalog.binary_upgrade_set_next_pg_tablespace_oid('%u'::pg_catalog.oid);\n", spcoid);
+ }
appendPQExpBuffer(buf, "CREATE TABLESPACE %s", fspcname);
appendPQExpBuffer(buf, " OWNER %s", fmtId(spcowner));