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

From Zhijie Hou
Subject Re: Fix apply worker crash when subscriber table has only a deferrable primary key
Date
Msg-id CAFvd2n90JW8kJHc6ZZ6VdvfrqRyW+SP2PRcD0P3h69SFGKWKvQ@mail.gmail.com
Whole thread
In response to Re: Fix apply worker crash when subscriber table has only a deferrable primary key  (Nisha Moond <nisha.moond412@gmail.com>)
Responses Re: Fix apply worker crash when subscriber table has only a deferrable primary key
List pgsql-hackers
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.


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);

The rest looks good to me.

Best Regards,
Zhijie Hou



pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: [PATCH] Two remaining shmem attachment issues in single-user mode
Next
From: vignesh C
Date:
Subject: Re: Publication DDL can race with a concurrent UPDATE