Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uo2R1-00FTma-PI for pgsql-bugs@arkaria.postgresql.org; Mon, 18 Aug 2025 16:10:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uo2R1-000L7i-43 for pgsql-bugs@arkaria.postgresql.org; Mon, 18 Aug 2025 16:10:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uo2R0-000L5o-QW for pgsql-bugs@lists.postgresql.org; Mon, 18 Aug 2025 16:10:11 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uo2Qz-000XuW-10 for pgsql-bugs@postgresql.org; Mon, 18 Aug 2025 16:10:11 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 57IGA5pL417488; Mon, 18 Aug 2025 12:10:05 -0400 From: Tom Lane To: "IVAN HUMANES CABANAS (Fujitsu)" cc: "pgsql-bugs@postgresql.org" Subject: Re: Error pg_upgrade version 11 to 15 In-reply-to: References: Comments: In-reply-to "IVAN HUMANES CABANAS (Fujitsu)" message dated "Mon, 18 Aug 2025 14:41:50 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <417486.1755533405.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 18 Aug 2025 12:10:05 -0400 Message-ID: <417487.1755533405@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "IVAN HUMANES CABANAS (Fujitsu)" writes: > command: "/usr/pgsql-15/bin/pg_restore" --host /var/lib/pgsql/15/data --= port 50432 --username postgres --clean --create --exit-on-error --verbose = --dbname postgres "/var/lib/pgsql/15/data/pg_upgrade_output.d/20250818T162= 430.400/dump/pg_upgrade_dump_18344416.custom" >> "/var/lib/pgsql/15/data/p= g_upgrade_output.d/20250818T162430.400/log/pg_upgrade_dump_18344416.log" 2= >&1 > pg_restore: connecting to database for restore > pg_restore: dropping DATABASE PROPERTIES template1 > pg_restore: dropping DATABASE template1 > pg_restore: while PROCESSING TOC: > pg_restore: from TOC entry 3677; 1262 18344416 DATABASE template1 postgr= es > pg_restore: error: could not execute query: ERROR: cannot drop a templa= te database > Command was: DROP DATABASE "template1"; Hm. The restore should have issued a command to make template1 not be a template database before dropping it. Apparently it did not do so. Looking at the code, a plausible theory for that is that template1 is not marked as a template database in the source cluster. Did you change that, and if so why? It would have broken more things than just pg_upgrade. regards, tom lane