Re: Issues with ON CONFLICT UPDATE and REINDEX CONCURRENTLY

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Mihail Nikalayeu <mihailnikalayeu(at)gmail(dot)com>
Cc: Alexander Lakhin <exclusion(at)gmail(dot)com>, 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: 2026-01-28 10:18:40
Message-ID: 202601281011.b6pvqpm4q5kn@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

On 2026-Jan-28, Mihail Nikalayeu wrote:

> > Actually, about this fragment ... if we track these ancestors for all
> > indexes, not just the ones that we consider as arbiters, don't we risk
> > doing something stupid when a completely unrelated index is being
> > reindexed? Namely, also consider that unrelated index as arbiter.
>
> Yes, such a thing may happen. It will not cause any error, because such an
> index will be used as artiber only if another compatible index in that same
> relation is present. And additional_arbiters will be incremented.
> Probably you think linitial() is "root", but it is an immediate parent.

Okay, this sounds good. Yes, I was thinking the linitial() was the
root, but a quick visit to get_partition_ancestors() clearly shows that
I was wrong.

> I am not sure I understood you correctly, but I added a comment about it.
> And about the opposite race + assert (not sure we need to keep it).

Interesting. Actually, I think you're wrong on this, because an OID
wraparound could happen such that the old index has a high-numbered OID,
and the reindexed one has a lower one. (This is not so preposterous as
it sounds, because the old index could have been created months ago, and
the counter recently wrapped around.) I don't know if we can find a way
to order the index list to prevent this problem.

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"Cómo ponemos nuestros dedos en la arcilla del otro. Eso es la amistad; jugar
al alfarero y ver qué formas se pueden sacar del otro" (C. Halloway en
La Feria de las Tinieblas, R. Bradbury)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Aditya Kamath 2026-01-28 10:25:41 RE: AIX support
Previous Message Ahmed Et-tanany 2026-01-28 10:16:21 [PATCH] Add max_logical_replication_slots GUC