Re: pg_dump crash on identity sequence with not loaded attributes

From: Artur Zakirov <zaartur(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: 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 15:21:33
Message-ID: CAKNkYnwTypJPsc258ZwVJ+n_Ti-8VxiQ6Gy4oMPmCA9fKo+KKg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, 9 Dec 2024 at 22:51, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Artur Zakirov <zaartur(at)gmail(dot)com> writes:
> > pg_dump crashes when a table is added into an extension and its
> > identity sequence isn't.
>
> Yup, reproduced here.

Thank you for looking into this. It seems that the original code was
introduced by the commit which fixed a similar crash:
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=b965f2617184032687037547204e1db1c1e1a56c

> /*
> * Only dump identity sequences if we're going to dump the table that
> * it belongs to.
> */
> - if (owning_tab->dobj.dump == DUMP_COMPONENT_NONE &&
> + if ((owning_tab->dobj.dump & DUMP_COMPONENT_DEFINITION) &&
> seqinfo->is_identity_sequence)
> {
> seqinfo->dobj.dump = DUMP_COMPONENT_NONE;

I think it is necessary to use negation in this condition. The patch
is attached. I checked the new patch and it works as expected.

--
Kind regards,
Artur

Attachment Content-Type Size
v2_pg_dump_ignore_notinteresting_sequence.patch application/octet-stream 786 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-12-10 15:29:52 Re: pg_dump crash on identity sequence with not loaded attributes
Previous Message Euler Taveira 2024-12-10 14:30:36 Re: postgres 16 index double variable seems to fail. postgres 15 OK