Skip to content

Commit 138c51b

Browse files
committed
Add missing binary-upgrade guard.
Commit 9a974cb 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
1 parent f1ac4a7 commit 138c51b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/bin/pg_dump/pg_dumpall.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,8 +1066,11 @@ dumpTablespaces(PGconn *conn)
10661066
/* needed for buildACLCommands() */
10671067
fspcname = pg_strdup(fmtId(spcname));
10681068

1069-
appendPQExpBufferStr(buf, "\n-- For binary upgrade, must preserve pg_tablespace oid\n");
1070-
appendPQExpBuffer(buf, "SELECT pg_catalog.binary_upgrade_set_next_pg_tablespace_oid('%u'::pg_catalog.oid);\n", spcoid);
1069+
if (binary_upgrade)
1070+
{
1071+
appendPQExpBufferStr(buf, "\n-- For binary upgrade, must preserve pg_tablespace oid\n");
1072+
appendPQExpBuffer(buf, "SELECT pg_catalog.binary_upgrade_set_next_pg_tablespace_oid('%u'::pg_catalog.oid);\n", spcoid);
1073+
}
10711074

10721075
appendPQExpBuffer(buf, "CREATE TABLESPACE %s", fspcname);
10731076
appendPQExpBuffer(buf, " OWNER %s", fmtId(spcowner));

0 commit comments

Comments
 (0)