Re: Fix race condition in pg_get_publication_tables with concurrent DROP TABLE

Bertrand Drouvot <bertranddrouvot.pg@gmail.com>

From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: shveta malik <shveta.malik@gmail.com>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-24T06:21:25Z
Lists: pgsql-hackers
Hi,

On Fri, Apr 24, 2026 at 11:19:40AM +0530, shveta malik wrote:
> On Thu, Apr 23, 2026 at 4:45 PM shveta malik <shveta.malik@gmail.com> wrote:
> >
> > On Thu, Apr 23, 2026 at 1:01 AM Bharath Rupireddy
> > <bharath.rupireddyforpostgres@gmail.com> wrote:
> > >
> I tried to find if any other code-part does that, found one refernce
> in hstore_svals():
> 
> /* ugly ugly ugly. why no macro for this? */
> (funcctx)->call_cntr++;
> 
> Having said that, I could not find any other way to implement the fix
> also.

What about introducing a publication_tables_state struct stored in user_fctx
that carries both the list and a private position index? (kind of what 
pg_timezone_abbrevs_zone() is doing).

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com