From: Andrew Dunstan <andrew@dunslane.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: IVAN HUMANES CABANAS (Fujitsu) <ivan.humanescabanas@fujitsu.com>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: Error pg_upgrade version 11 to 15
Date: Mon, 18 Aug 2025 15:16:46 -0400
Message-ID: <6545b4ca-a685-4a30-8aec-451dcb891d0b@dunslane.net> (raw)
In-Reply-To: <417487.1755533405@sss.pgh.pa.us>
References: <AMBP191MB2746B1A4B24D87330C7A028DFD31A@AMBP191MB2746.EURP191.PROD.OUTLOOK.COM>
<417487.1755533405@sss.pgh.pa.us>
On 2025-08-18 Mo 12:10 PM, Tom Lane wrote:
> "IVAN HUMANES CABANAS (Fujitsu)"<ivan.humanescabanas@fujitsu.com> 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/20250818T162430.400/dump/pg_upgrade_dump_18344416.custom" >> "/var/lib/pgsql/15/data/pg_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 postgres
>> pg_restore: error: could not execute query: ERROR: cannot drop a template 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.
>
>
Template1 normally has an OID of 1, but this database has an apparent
OID of 18344416. Maybe this has been the result of a previous upgrade -
we don't have enough information. I don't think pg_upgrade attempts to
preserve database OIDs.
cheers
andrew
--
Andrew Dunstan
EDB:https://www.enterprisedb.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: andrew@dunslane.net, tgl@sss.pgh.pa.us, ivan.humanescabanas@fujitsu.com
Subject: Re: Error pg_upgrade version 11 to 15
In-Reply-To: <6545b4ca-a685-4a30-8aec-451dcb891d0b@dunslane.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox