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 1tL3eV-00CSvN-9G for pgsql-bugs@arkaria.postgresql.org; Tue, 10 Dec 2024 17:04:03 +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 1tL3eS-007FUh-CT for pgsql-bugs@arkaria.postgresql.org; Tue, 10 Dec 2024 17:04:01 +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 1tL3eS-007FUZ-3W for pgsql-bugs@lists.postgresql.org; Tue, 10 Dec 2024 17:04:01 +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 1tL3eQ-0026uy-8K for pgsql-bugs@lists.postgresql.org; Tue, 10 Dec 2024 17:04:00 +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 4BAH3q8f077016; Tue, 10 Dec 2024 12:03:52 -0500 From: Tom Lane To: Peter Eisentraut cc: Artur Zakirov , PostgreSQL mailing lists Subject: Re: pg_dump crash on identity sequence with not loaded attributes In-reply-to: References: Comments: In-reply-to Peter Eisentraut message dated "Tue, 10 Dec 2024 16:34:48 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <77014.1733850232.1@sss.pgh.pa.us> Date: Tue, 10 Dec 2024 12:03:52 -0500 Message-ID: <77015.1733850232@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Peter Eisentraut writes: > On 09.12.24 16:54, Artur Zakirov wrote: >> pg_dump crashes when a table is added into an extension and its >> identity sequence isn't. > Maybe the bug is that this scenario is possible in the first place? The > identity sequence is an internal dependency. It would be like putting a > view into an extension but not the underlying rule? As far as I can tell, views' rules are not marked as direct members of the extension, whether they are made within the extension's script or later on. The same for indexes. (I think this was intentional to avoid bloating pg_depend more than necessary.) So those cases might not be great analogies. Rules and indexes can't exist except as auxiliary objects of a table, so a sequence isn't quite the same situation anyway. Even if we hacked things up so that the sequence got added to the table's extension, a user could still get into this state with ALTER EXTENSION ... DROP SEQUENCE. So between that and having existing databases with the issue, I think pg_dump has to be made to cope with it. I'm also talking myself into the idea that we have to do our best to actually reproduce the situation, not just ignore the sequence, which is what the currently-proposed patch would do. Maybe forcing owning_tab->interesting to true is the right fix? But the rule about "don't dump sequences of not-to-be-dumped-tables" is still problematic from this standpoint. regards, tom lane