Re: pg_dump crash on identity sequence with not loaded attributes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Artur Zakirov <zaartur(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_dump crash on identity sequence with not loaded attributes
Date: 2024-12-10 17:03:52
Message-ID: 77015.1733850232@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Peter Eisentraut <peter(at)eisentraut(dot)org> 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Artur Zakirov 2024-12-10 17:54:22 Re: pg_dump crash on identity sequence with not loaded attributes
Previous Message Peter Eisentraut 2024-12-10 15:34:48 Re: pg_dump crash on identity sequence with not loaded attributes