Re: Fix race condition in pg_get_publication_tables with concurrent DROP TABLE - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: Fix race condition in pg_get_publication_tables with concurrent DROP TABLE
Date
Msg-id CALj2ACU29tM_SPdiW1hPtWYocvnpNfuOWXiOh1Q58cSHpYQ7zQ@mail.gmail.com
Whole thread
In response to Re: Fix race condition in pg_get_publication_tables with concurrent DROP TABLE  (shveta malik <shveta.malik@gmail.com>)
Responses Re: Fix race condition in pg_get_publication_tables with concurrent DROP TABLE
List pgsql-hackers
Hi,

On Tue, Apr 28, 2026 at 8:28 PM shveta malik <shveta.malik@gmail.com> wrote:
>
> On Wed, Apr 29, 2026 at 7:12 AM Ajin Cherian <itsajin@gmail.com> wrote:
>
> > One small comment. The includes need to be in alphabetical order.
> > injection_point.h should come after fmgroids.h
> >
> > +#include "utils/injection_point.h"
> >  #include "utils/syscache.h"
>
> Also there is a trailing whitespace issue while applying the patch.
> Other than these, the patch looks good.

Fixed. Please find the attached v5 patch.

The fix is needed only for PG16 and later, not PG15 or PG14. The bug
was introduced by b7ae03953690 [1] in PG16, which added a table_open()
call in pg_get_publication_tables(). PG15 and earlier only use
get_rel_namespace() and syscache lookups, both of which gracefully
handle dropped relations (returning InvalidOid/false rather than
erroring).

I verified the bug and the fix on all affected branches. Please find
the attached version-specific patches for backpatching. Thank you!

[1] b7ae03953690 - Ignore dropped and generated columns from the column list

--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com

Attachment

pgsql-hackers by date:

Previous
From: shveta malik
Date:
Subject: Re: Proposal: Conflict log history table for Logical Replication
Next
From: John Naylor
Date:
Subject: Re: off-by-one in pg_repack index loop