Re: Error pg_upgrade version 11 to 15

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "IVAN HUMANES CABANAS (Fujitsu)" <ivan(dot)humanescabanas(at)fujitsu(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Error pg_upgrade version 11 to 15
Date: 2025-08-18 16:10:05
Message-ID: 417487.1755533405@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"IVAN HUMANES CABANAS (Fujitsu)" <ivan(dot)humanescabanas(at)fujitsu(dot)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.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message vignesh C 2025-08-18 16:41:04 Re: BUG #18988: DROP SUBSCRIPTION locks not-yet-accessed database
Previous Message IVAN HUMANES CABANAS (Fujitsu) 2025-08-18 14:41:50 Error pg_upgrade version 11 to 15