Re: [PATCH] Fix NULL dereference in subscription REFRESH on concurrent DROP

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: Ajin Cherian <itsajin(at)gmail(dot)com>, SATYANARAYANA NARLAPURAM <satyanarlapuram(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Fix NULL dereference in subscription REFRESH on concurrent DROP
Date: 2026-08-21 17:47:59
Message-ID: CAD21AoCdCzrce_=FTf0E0awQ5baHYemA7T+bah6SXXjsy7ysUA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 20, 2026 at 11:13 PM Bharath Rupireddy
<bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
>
> Hi,
>
> On Thu, Aug 20, 2026 at 5:26 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
> >
> > Thank you for updating the patch! Here are some review comments:
>
> Thanks for reviewing it.
>
> > --- a/src/test/subscription/t/001_rep_changes.pl
> >
> > 100_bugs.pl seems a better place to have have this regression test.
>
> Agreed.
>
> > ---
> > + $bg->quit;
> > +
> > + is($node_subscriber->safe_psql('postgres', 'SELECT 1;'),
> > + '1', 'refresh survived a concurrently dropped table
> > and sequence');
> >
> > While the background psql session survives with the proposed fix, the
> > ALTER SUBSCRIPTION ... REFRESH command still fails since the table and
> > sequence no longer exist on the subscriber. I think it's better to
> > make the command done without an error.
>
> Ah, good catch. Yes, that's better.
>
> > I think we can have the regression test in v19 too as it can be added easily.
>
> I'm fine with it. My thinking is that for back branches, adding tests
> for bugs makes sense as long as it doesn't introduce complexity (like
> adding an injection point dependency for logical replication TAP
> tests). Otherwise the fix itself is sufficient.
>
> > I've made some changes including the above comments and updated the
> > commit message. I've attached the patch for HEAD. Please review it.
>
> The v4 patch looks good to me. pgindent, make check, and make
> check-world are all fine.

Thank you for reviewing the patch!

I'll prepare patches for backbranches based on the v4 patch and push
them early next week, barring objections.

Regards,

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2026-08-21 18:16:02 Re: Race conditions in logical decoding
Previous Message Nisha Moond 2026-08-21 17:30:38 Re: Support EXCEPT for TABLES IN SCHEMA publications