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 CALj2ACVv3NNVtqytJR=b4MwPmBm9AckRexGo7r0oVLqWe69NKg@mail.gmail.com
Whole thread
In response to Re: Fix race condition in pg_get_publication_tables with concurrent DROP TABLE  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
List pgsql-hackers
Hi,

On Wed, Apr 29, 2026 at 12:15 AM Bharath Rupireddy
<bharath.rupireddyforpostgres@gmail.com> wrote:
>
> 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

Please find the attached v6 patch, which fixes a test failure on
FreeBSD. This variant of the build forces parallel query via
debug_parallel_query=regress, causing the pg_get_publication_tables
injection point to fire in parallel workers as well. I disabled forced
parallel query for this test case.

Thank you!


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

Attachment

pgsql-hackers by date:

Previous
From: Chao Li
Date:
Subject: Adjust pg_stat_get_lock() prorows to match lock types
Next
From: Tom Lane
Date:
Subject: Re: Make printtup a bit faster