Re: Fix apply worker crash when subscriber table has only a deferrable primary key - Mailing list pgsql-hackers

From Nisha Moond
Subject Re: Fix apply worker crash when subscriber table has only a deferrable primary key
Date
Msg-id CABdArM4=Lgmj1Ab2xEXLCFmhJuf+wOppO8UTRU9HWVQbj5uKUw@mail.gmail.com
Whole thread
In response to Re: Fix apply worker crash when subscriber table has only a deferrable primary key  (Zhijie Hou <houzhijie22@gmail.com>)
Responses Re: Fix apply worker crash when subscriber table has only a deferrable primary key
List pgsql-hackers
On Thu, Oct 1, 2026 at 4:16 PM Zhijie Hou <houzhijie22@gmail.com> wrote:
>
> Hi,
>
> On Thu, Oct 1, 2026 at 2:39 PM Nisha Moond <nisha.moond412@gmail.com> wrote:
> >
> > Attached updated patches v5. There are a couple of optimizations and
> > comment improvements in 002(testcode) too.
>
> Thanks for the patch. It looks good to me overall, I just have coding
> suggestions:
>
> 1.
>
> Relation idxrel = index_open(idxoid, AccessShareLock);
>
> We shall use NoLock here, since the index must have been locked already.
>

Makes sense, the index is always already locked when we get here. I
also added a comment.

>
> 2.
>
> + for (int i = 0; i < idxrel->rd_index->indnkeyatts; i++)
> + {
> + AttrNumber attnum = idxrel->rd_index->indkey.values[i];
> +
> + Assert(AttributeNumberIsValid(attnum));
> + indexbitmap = bms_add_member(indexbitmap,
> + attnum - FirstLowInvalidHeapAttributeNumber);
> + }
>
> This Assert also looks unnecessary, removing it would make the code more
> concise:
>
> for (int i = 0; i < idxrel->rd_index->indnkeyatts; i++)
>     indexbitmap = bms_add_member(indexbitmap,
>         idxrel->rd_index->indkey.values[i] -
> FirstLowInvalidHeapAttributeNumber);
>

Done.

--
Thanks,
Nisha

Attachment

pgsql-hackers by date:

Previous
From: Tatsuya Kawata
Date:
Subject: Re: [PATCH] Add memory/disk usage for Function Scan nodes in EXPLAIN
Next
From: Shinya Kato
Date:
Subject: Re: Report oldest xmin source when autovacuum cannot remove tuples