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 1uo5Lk-00G9cr-UJ for pgsql-bugs@arkaria.postgresql.org; Mon, 18 Aug 2025 19:16:58 +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 1uo5Li-001i5m-G4 for pgsql-bugs@arkaria.postgresql.org; Mon, 18 Aug 2025 19:16:55 +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 1uo5Li-001i57-1v for pgsql-bugs@lists.postgresql.org; Mon, 18 Aug 2025 19:16:54 +0000 Received: from mail-qk1-x736.google.com ([2607:f8b0:4864:20::736]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uo5Lf-000ZM6-0j for pgsql-bugs@postgresql.org; Mon, 18 Aug 2025 19:16:53 +0000 Received: by mail-qk1-x736.google.com with SMTP id af79cd13be357-7e8706764d2so595105085a.2 for ; Mon, 18 Aug 2025 12:16:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dunslane-net.20230601.gappssmtp.com; s=20230601; t=1755544609; x=1756149409; darn=postgresql.org; h=in-reply-to:autocrypt:content-language:from:references:cc:to :subject:user-agent:mime-version:date:message-id:from:to:cc:subject :date:message-id:reply-to; bh=sTy5hajEUp4vFSc9oTu5+TV03oIymuqAgIK2Lhng764=; b=m9HRyKDG3u/cNinUILB8nadJ3SY8Y1hyWjIAZSEHSuWpzu/5D2NMX/86b59ngma8SM 2FlfyIzVq/xXFHkEFoesLnJJO5EDma/qnT9Io1C94ubFD6IDPKdblLThkBbGvYzoswnK ADIkuJFwz4v1/6c8IJr867jT9MVPZ1TjJvUrS05KEyJppZ5y1AVPxzsV3NJzBVq/0WCf pXN6SybJ32J1/twmL8lJ7WB2TQK59wNlKnM95I6rghpIbl4uXRcrTGSKqGPBkbT0DgpK sAhY7HvenNa1QaGRR+dnvCaRY+e0mNkQF6+Qvu3gSUH/WSP/fnRY5OZ31Fd1Rj4tcuts j5ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755544609; x=1756149409; h=in-reply-to:autocrypt:content-language:from:references:cc:to :subject:user-agent:mime-version:date:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=sTy5hajEUp4vFSc9oTu5+TV03oIymuqAgIK2Lhng764=; b=qDX5GEpfqnb3Crjn47ua+BJeE7KutjoT+GVxW8QsdNtalPlgJ8h5V9CIla1MVaEDz6 fKPG5clisxtpuiIrv/L/xku10fxKpN3lh3g4DQ3eLFSv7BlT66vC4M984YFNqdlIEjYB pkSrEPNr27wBOz8P/wq9W9h0x9Zph/4pBzdWjLGMONhvhIks2LCXo0qlF5wuHx7vhpZ+ EC67HQI3kzNR6Ufa93wOgoTctZAW2lC1HL77yvY5zwTKEt4bxS9ZPMRc4ysT3xK7u0uu XLmegSH46yIgOl+1jXVSP6W2LqSWgwaUT+BATMmpYU/zl1UNDntTXunm4Hu42Z0YG+Lh gkzA== X-Gm-Message-State: AOJu0YzZxuHESBr0k2yO6jvJLf0Pbb77HtFB7dn8sfJ8WwBeoUtNo/hC Ppa87qlzINoekbcGFWH35NSbedSmhogAh/1Pb5+2ubnQBfhu9vTOPqOPhHOZThkUbXs= X-Gm-Gg: ASbGncvzltgAsfBMOx3VRomnOnmX6wxOfvK3vfbdFsMBW4mPhArP+eyvCVQ/sn9Xp3d +/VBdVoAhiA+yNgBksAqPZSHKXKgYCK1WqrbiiRdhKMqoUdCm/Fyf2w4emhFjrAg2WgcmfssLxz kQSOaNsrz8sJD53TvYupOEBiTWQLHhoNDms6wSM/rS4fDl5csONMdLc+kAt6LbCZLKoCr6aE1ne Puv9ArtvbUq1UpLsO+f4sDB5zKicrgRhe+4wAzrMuDPOJtRB4I/mK6VPyuwvBTIZK5UyNw5aWKh 7eJeE9KsvXlgIRYClCWyGZVcw4sljZIaHS3zsojFh9F6VE6lQUrpONDOeI4AWOV6cMRMULFE3c5 aTqaoH8jjdAMfxuIzFPsTVD2gW0LDAIjKWH/TL0Rt X-Google-Smtp-Source: AGHT+IFghEoLVAYzAilSl12PjSEFKandpRw1W+a49dxdA92pAEVhJCWjDIggFkQx9KgYPTgBIlTUww== X-Received: by 2002:a05:620a:1a8e:b0:7e8:1683:485b with SMTP id af79cd13be357-7e9f3316607mr5065785a.10.1755544608374; Mon, 18 Aug 2025 12:16:48 -0700 (PDT) Received: from ?IPV6:2605:a601:a6b0:500::1cb? ([2605:a601:a6b0:500::1cb]) by smtp.googlemail.com with ESMTPSA id af79cd13be357-7e87e0204f3sm646298785a.9.2025.08.18.12.16.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 Aug 2025 12:16:47 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------OPpijjnQx6fE4yHmhj9ylcpn" Message-ID: <6545b4ca-a685-4a30-8aec-451dcb891d0b@dunslane.net> Date: Mon, 18 Aug 2025 15:16:46 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Error pg_upgrade version 11 to 15 To: Tom Lane , "IVAN HUMANES CABANAS (Fujitsu)" Cc: "pgsql-bugs@postgresql.org" References: <417487.1755533405@sss.pgh.pa.us> From: Andrew Dunstan Content-Language: en-US Autocrypt: addr=andrew@dunslane.net; keydata= xsBNBE7KWFkBCAClridxur2AIc7eW2AR7izbfp3EnNefie2HbLF0izW5Ik5UjX2HBXBx4syI gY6b0ugohXrr274+baoAlvSbq6cAoQuEVrk5IZFzt20b1Xkx65FwGSEj526yiKLocqkJceSq Xr9xcA5SGY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qZRtnEAEQEAAcLAfAQYAQgAJgIbDBYhBOQ+WEYd/Hy/RGkVpZn6f8tZ/DuBBQJoGNI2BQkd EODdAAoJEJn6f8tZ/DuBfw0IAKTsfD40teP/pp+bsLLMSxPXUYrrprTj7WFB5v61p6dkpSr/ qXmMlyahdxQFaPmfVgVirB1Vk/kHiWNnnGjfUV9nB2Zg9LI0Xb9/ts3LsUiRWXzG3tkMY6XL vsVOxW4XFRND9l2q+WW93aZ1DZl+fqWfYgMvsusFRhmGFOKTRfKPta2Pkv+AhA24N4+PrR5p bU4k2MO8PAGiK8eaYKGFG1bHKuAvoDoF7WXJ3FHxuWqLnKEt4dfOLm5pAe3zq1Lt6q8azT9i QWGpSAK5vQUWQHBHpiDjdPeqKZ6HiAXIIKfSmb+jrvXBqoP+D6/K7rUjG2aXiRtTIAXms9sm VRu7cmw= In-Reply-To: <417487.1755533405@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------OPpijjnQx6fE4yHmhj9ylcpn Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2025-08-18 Mo 12:10 PM, Tom Lane wrote: > "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/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 --------------OPpijjnQx6fE4yHmhj9ylcpn Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit


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
--------------OPpijjnQx6fE4yHmhj9ylcpn--