Re: BUG #19884: pg_publication_tables omits a detach-pending partition in root mode

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>
Cc: Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>, 1548140642(at)qq(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19884: pg_publication_tables omits a detach-pending partition in root mode
Date: 2026-11-14 01:44:27
Message-ID: CAD21AoBya8jmFaqy7rXwngHWK4vVh71oGjEnP0gdvVrU1HwOMA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Nov 12, 2026 at 8:43 PM Nisha Moond <nisha(dot)moond412(at)gmail(dot)com> wrote:
>
> On Fri, Nov 13, 2026 at 3:16 AM Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com> wrote:
> >
> >
> >
> > чт, 12 нояб. 2026 г. в 22:16, PG Bug reporting form <noreply(at)postgresql(dot)org>:
> >>
> >> The following bug has been logged on the website:
> >>
> >> Bug reference: 19884
> >> Logged by: Milo
> >> Email address: 1548140642(at)qq(dot)com
> >> PostgreSQL version: 18.6
> >> Operating system: Linux/amd64
> >> Description:
> >>
> >> After phase one of ALTER TABLE ... DETACH PARTITION CONCURRENTLY,
> >> pg_publication_tables omits the detach-pending child from an ALL TABLES
> >> publication when publish_via_partition_root is enabled. At that point the
> >> child has no ancestors and is treated as a standalone relation for
> >> publication purposes, so it should appear in the view. The query instead
> >> returns zero rows.
> >>
> >>
> >
> > Hi Milo!
> >
> > Thanks for the report.
> >
> > I was also able to reproduce the problem on the master branch.
> >
> > I think we can fix this by using get_partition_ancestors() in pg_get_publication_tables().
> > After the pending detach commits, that list is empty, so the table stays in the publication.
> >
> > Patch in attachment.
> >
>
> Thanks for the report and the patch. This appears to be the same issue
> reported in [1]. Patch v2-0003 shared in [2] fixes it for ALL TABLES
> publications, and also for the EXCEPT case, which is affected by the
> same root cause.

Yes, this has the same root cause and I've also confirmed that these
patches fix the issue reported here.

Regards,

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Dilip Kumar 2026-11-14 10:48:29 Re: BUG #19864: pg_get_publication_tables() gets cache lookup error after concurrent DROP PUBLICATION
Previous Message Andrey Rachitskiy 2026-11-13 21:17:05 Re: BUG #19837: ORDER BY/DISTINCT ON use wrong column with grouping set duplicates