Peter Eisentraut <peter@eisentraut.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