Re: Fix race condition in pg_get_publication_tables with concurrent DROP TABLE
Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
To: shveta malik <shveta.malik@gmail.com>
Cc: Ajin Cherian <itsajin@gmail.com>,
Bertrand Drouvot <bertranddrouvot.pg@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-29T07:15:00Z
Lists: pgsql-hackers
Attachments
- v5-0001-PG16-Fix-pg_get_publication_tables-race-with-conc.txt (text/plain)
- v5-0001-Fix-pg_get_publication_tables-race-with-concurren.patch (application/octet-stream) patch v5-0001
- v5-0001-PG18-Fix-pg_get_publication_tables-race-with-conc.txt (text/plain)
- v5-0001-PG17-Fix-pg_get_publication_tables-race-with-conc.txt (text/plain)
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