Re: Apply worker can pick an invalid index for REPLICA IDENTITY FULL lookups

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Mihail Nikalayeu <mihailnikalayeu(at)gmail(dot)com>
Cc: Miłosz Bieniek <bieniek(dot)milosz(at)proton(dot)me>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, onderkalaci(at)gmail(dot)com
Subject: Re: Apply worker can pick an invalid index for REPLICA IDENTITY FULL lookups
Date: 2026-08-25 10:05:03
Message-ID: CAA4eK1LK5yNNvLFBS0KHpM50Ek7ys-8_=qKX-v=e6UvpzR5wow@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Aug 24, 2026 at 9:23 PM Mihail Nikalayeu
<mihailnikalayeu(at)gmail(dot)com> wrote:
>
> > Any thoughts on moving the 'idxRel->rd_index->indisvalid' check into 'IsIndexUsableForReplicaIdentityFull()' itself?
>
> I initially thought about that approach too, but an assertion also
> uses that check.
> This is explained in the commit message:
>
> > Skip invalid indexes, as the planner does. The test belongs here rather
> > than in IsIndexUsableForReplicaIdentityFull(), whose other caller is an
> > assertion that would then trip over an index DROP INDEX CONCURRENTLY has
> > just invalidated but that still finds tuples fine.
>

I think it is better to add some comments in the code as well. See
attached. I have added # in the test comments to make it similar to
the previous test. Otherwise, the patch LGTM.

--
With Regards,
Amit Kapila.

Attachment Content-Type Size
add_comments_1.patch application/octet-stream 1.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2026-08-25 10:06:53 Re: Support EXCEPT for TABLES IN SCHEMA publications
Previous Message Gaurav Singh 2026-08-25 09:56:37 pg_stat_statements: a reset mid-query leaves an entry unnormalized forever