Re: Issues with ON CONFLICT UPDATE and REINDEX CONCURRENTLY

From: Mihail Nikalayeu <mihailnikalayeu(at)gmail(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Noah Misch <noah(at)leadboat(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Issues with ON CONFLICT UPDATE and REINDEX CONCURRENTLY
Date: 2025-11-28 18:21:06
Message-ID: CADzfLwUdP6kS+kKbVE6kOrz6CwYCuK6oU2HWNOvZ-z1TBtcweQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello!

On Fri, Nov 28, 2025 at 6:30 PM Álvaro Herrera <alvherre(at)kurilemu(dot)de> wrote:
> I wasn't happy with the idea of opening all indexes twice in
> infer_arbiter_indexes(), so I instead made it collect all Relations from
> those indexes in an initial loop, then process them in the two places
> that wanted them, and we close them all again together. I think this
> also makes the code clearer. We no longer have the "next" goto label to
> close the index at the bottom of the loop, but instead we can just do
> "continue" cleanly.

Yes, agreed - that looks better than my version.

Few moments:

> Second, if an attribute list was specified in the ON
>* CONFLICT clause, we use the list to find the indexes whose attributes
>* match that list.
I think we may notice expressions and predicates also.

> /*
> * Find the named constraint index to extract its attributes and
> * predicates.
> */
> foreach_ptr(RelationData, idxRel, indexRelList)

Should we consider assert to ensure we have actually found something?

Best regards,
Mikhail.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marcos Pegoraro 2025-11-28 18:27:15 Re: [PoC] XMLCast (SQL/XML X025)
Previous Message Andrey Borodin 2025-11-28 18:17:41 Re: IPC/MultixactCreation on the Standby server