Re: pg_dump crash due to incomplete ordering of DO_SUBSCRIPTION_REL objects

From: vignesh C <vignesh21(at)gmail(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_dump crash due to incomplete ordering of DO_SUBSCRIPTION_REL objects
Date: 2025-12-16 11:52:36
Message-ID: CALDaNm1cJmD0RKpo8GS34jDvaQPC9U7MCr6UU7HcupAe0_a77Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 16 Dec 2025 at 00:00, Noah Misch <noah(at)leadboat(dot)com> wrote:
>
> On Mon, Dec 15, 2025 at 11:35:35PM +0530, vignesh C wrote:
> > While verifying upgrade of subscriber instance, I noticed pg_dump
> > crash caused by incomplete sorting logic for DO_SUBSCRIPTION_REL
> > objects in DOTypeNameCompare(). When multiple subscription–relation
> > entries belong to the same subscription, the comparison does not
> > establish a complete ordering. In this case, the comparison falls
> > through to the generic assertion path. The attached patch fixes this
> > by extending the comparison for DO_SUBSCRIPTION_REL objects to include
> > deterministic ordering keys. After the subscription name comparison,
> > entries are ordered by the referenced table's schema name and then by
> > table name.
> >
> > This issue has started failing after commit:
> > commit 0decd5e89db9f5edb9b27351082f0d74aae7a9b6
> > Sort dump objects independent of OIDs, for the 7 holdout object types.
> >
> > This can be reproduced by having logical replication setup with
> > subscription subscribing to few tables.
>
> That makes sense. Thanks. Do you have commands we could add to
> src/test/regress/sql/subscription.sql to cover this code?

This dumping of subscription relation is specific to upgrading to
preserve the subscription relation. So I felt we will not be able to
add tests to subscription.sql, instead how about adding one more table
to 004_subscription.pl where subscription upgrade tests are verified
like the attached patch.

Regards,
Vignesh

Attachment Content-Type Size
v2-0001-Fix-pg_dump-crash-for-DO_SUBSCRIPTION_REL-sorting.patch text/x-patch 4.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Borodin 2025-12-16 12:02:52 Re: amcheck: support for GiST
Previous Message Hayato Kuroda (Fujitsu) 2025-12-16 11:35:34 RE: Parallel Apply