Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nJDPS-0005aQ-0L for pgsql-hackers@arkaria.postgresql.org; Sun, 13 Feb 2022 11:51:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nJDPQ-0004Ng-OV for pgsql-hackers@arkaria.postgresql.org; Sun, 13 Feb 2022 11:51:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nJDPQ-0004NX-FW for pgsql-hackers@lists.postgresql.org; Sun, 13 Feb 2022 11:51:16 +0000 Received: from feynman.df7cb.de ([195.49.152.168]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nJDPO-000621-1J for pgsql-hackers@lists.postgresql.org; Sun, 13 Feb 2022 11:51:16 +0000 Received: from msg.df7cb.de (unknown [IPv6:2a02:908:1477:7740:df3c:d202:ca71:8aa5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by feynman.df7cb.de (Postfix) with ESMTPSA id 4JxQfl0TTtz3DwT; Sun, 13 Feb 2022 12:51:11 +0100 (CET) Date: Sun, 13 Feb 2022 12:51:10 +0100 From: Christoph Berg To: Robert Haas Cc: pgsql-hackers@lists.postgresql.org Subject: Re: pgsql: pg_upgrade: Preserve relfilenodes and tablespace OIDs. Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Re: Robert Haas > pg_upgrade: Preserve relfilenodes and tablespace OIDs. > src/bin/pg_dump/pg_dumpall.c | 3 + --- a/src/bin/pg_dump/pg_dumpall.c +++ b/src/bin/pg_dump/pg_dumpall.c @@ -1066,6 +1066,9 @@ dumpTablespaces(PGconn *conn) /* needed for buildACLCommands() */ fspcname = pg_strdup(fmtId(spcname)); + appendPQExpBufferStr(buf, "\n-- For binary upgrade, must preserve pg_table + appendPQExpBuffer(buf, "SELECT pg_catalog.binary_upgrade_set_next_pg_table This needs to be guarded with "if (binary_upgrade)". Error message during a Debian pg_upgradecluster (-m dump) from 14 to 15: 2022-02-13 12:44:01.272 CET [168032] postgres@template1 LOG: statement: SELECT pg_catalog.binary_upgrade_set_next_pg_tablespace_oid('16408'::pg_catalog.oid); 2022-02-13 12:44:01.272 CET [168032] postgres@template1 ERROR: function can only be called when server is in binary upgrade mode 2022-02-13 12:44:01.272 CET [168032] postgres@template1 STATEMENT: SELECT pg_catalog.binary_upgrade_set_next_pg_tablespace_oid('16408'::pg_catalog.oid); Christoph