Re: Issues with ON CONFLICT UPDATE and REINDEX CONCURRENTLY

From: Mihail Nikalayeu <mihailnikalayeu(at)gmail(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Issues with ON CONFLICT UPDATE and REINDEX CONCURRENTLY
Date: 2025-11-03 20:41:00
Message-ID: CADzfLwU+oXdzY9xZQ2ayTROzgrEHxf=S8BV_mRSkXv_ZCukrug@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello!

On Mon, Nov 3, 2025 at 12:21 AM Noah Misch <noah(at)leadboat(dot)com> wrote:
> Thanks. Does "ON CONFLICT ON CONSTRAINT constraint_name" avoid the problem w/
> concurrent REINDEX CONCURRENTLY? A search of the thread found no mention of
> "ON CONSTRAINT". It seems safe to assume that clause would avoid problems w/
> CREATE INDEX CONCURRENTLY, but that's less certain for REINDEX.

It is also affected. There is a special
reindex_concurrently_upsert_on_constraint spec in the patch.
And even a special commit (0004) to fix it :)

But yes, it happens only in the case of REINDEX.

I removed the mention of "ON CONSTRAINT" and added a small comment
near infer_arbiter_indexes.

Doc patch is 0001, other - specs and fixes for future.

Best regards,
Mikhail.

Attachment Content-Type Size
v11-0002-Specs-to-reproduce-the-issues-with-CREATE-INDEX-.patch application/octet-stream 48.2 KB
v11-0005-Modify-the-ExecInitPartitionInfo-function-to-con.patch application/octet-stream 6.1 KB
v11-0003-Modify-the-infer_arbiter_indexes-function-to-con.patch application/octet-stream 2.9 KB
v11-0006-Revert-Doc-cover-index-CONCURRENTLY-causing-erro.patch application/octet-stream 2.0 KB
v11-0004-Modify-the-infer_arbiter_indexes-function-to-als.patch application/octet-stream 8.1 KB
v11-0001-Doc-cover-index-CONCURRENTLY-causing-errors-in-I.patch application/octet-stream 2.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-11-03 20:53:29 Re: psql --help=variables missing csv_fieldsep
Previous Message Matheus Alcantara 2025-11-03 20:38:35 Re: Have the planner convert COUNT(1) / COUNT(not_null_col) to COUNT(*)