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 1sZWi1-001ahq-Tk for pgsql-bugs@arkaria.postgresql.org; Thu, 01 Aug 2024 14:23: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 1sZWi0-00AVQh-6d for pgsql-bugs@arkaria.postgresql.org; Thu, 01 Aug 2024 14:23:12 +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 1sZWhz-00AVQY-UC for pgsql-bugs@lists.postgresql.org; Thu, 01 Aug 2024 14:23: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.94.2) (envelope-from ) id 1sZWhx-002cNA-06 for pgsql-bugs@lists.postgresql.org; Thu, 01 Aug 2024 14:23:10 +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 471EN4Nu3736991; Thu, 1 Aug 2024 10:23:04 -0400 From: Tom Lane To: postgresql@blakeslee.uk cc: pgsql-bugs@lists.postgresql.org, Peter Eisentraut Subject: Re: BUG #18562: pg_upgrade (14.12 -> 15.7/16.3) fails when schema has unlogged table with logged sequence In-reply-to: <18562-46a7ee9a7b1ee153@postgresql.org> References: <18562-46a7ee9a7b1ee153@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Thu, 01 Aug 2024 11:35:46 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3736989.1722522184.1@sss.pgh.pa.us> Date: Thu, 01 Aug 2024 10:23:04 -0400 Message-ID: <3736990.1722522184@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > I am seeing a recurring failure when attempting to run pg_upgrade on a 14.12 > database when targeting 15.7 or 16.3. > I've found this error to occur whenever the schema contains an unlogged > table with a logged sequence. Yeah, the way that pg_dump tries to set this situation up is to create the sequence by using ALTER COLUMN ADD GENERATED, and then change the sequence's logged-ness. That cannot work in binary-upgrade mode. Before we think about alternative ways to dump it though, I wonder why we permit such a situation at all. It doesn't seem like a well-considered bit of database design for an identity sequence's logged-ness to differ from the owning table's. The combination of logged table and unlogged sequence is surely a foot-gun, even if you think there's some value in the other way. But we allow both. regards, tom lane