Re: pg_dump crash on identity sequence with not loaded attributes
Artur Zakirov <zaartur@gmail.com>
From: Artur Zakirov <zaartur@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2024-12-10T15:21:33Z
Lists: pgsql-bugs
Attachments
- v2_pg_dump_ignore_notinteresting_sequence.patch (application/octet-stream) patch v2
On Mon, 9 Dec 2024 at 22:51, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Artur Zakirov <zaartur@gmail.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
Commits
-
Fix possible crash in pg_dump with identity sequences.
- c7f3c414fded 14.16 landed
- b6df2d6e5d83 13.19 landed
- ad950ea98e54 17.3 landed
- 7b8cb9cd6a76 18.0 landed
- 782cc1aa3d15 16.7 landed
- 6978129b4e95 15.11 landed
-
Do not dump identity sequences with excluded parent table
- b965f2617184 12.0 cited