v11-0001-Doc-cover-index-CONCURRENTLY-causing-errors-in-I.patch
application/octet-stream
Filename: v11-0001-Doc-cover-index-CONCURRENTLY-causing-errors-in-I.patch
Type: application/octet-stream
Part: 5
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v11-0001
Subject: Doc: cover index CONCURRENTLY causing errors in INSERT ... ON CONFLICT.
| File | + | − |
|---|---|---|
| doc/src/sgml/ref/insert.sgml | 9 | 0 |
| src/backend/optimizer/util/plancat.c | 5 | 0 |
From 606df58881bfcdf50eea93d34308591bd3997fb5 Mon Sep 17 00:00:00 2001
From: Noah Misch <noah@leadboat.com>
Date: Mon, 3 Nov 2025 20:19:10 +0100
Subject: [PATCH v11 1/6] Doc: cover index CONCURRENTLY causing errors in
INSERT ... ON CONFLICT.
Author: Mikhail Nikalayeu <mihailnikalayeu@gmail.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Discussion: https://postgr.es/m/CANtu0ojXmqjmEzp-=aJSxjsdE76iAsRgHBoK0QtYHimb_mEfsg@mail.gmail.com
Backpatch-through: 13
---
doc/src/sgml/ref/insert.sgml | 9 +++++++++
src/backend/optimizer/util/plancat.c | 5 +++++
2 files changed, 14 insertions(+)
diff --git a/doc/src/sgml/ref/insert.sgml b/doc/src/sgml/ref/insert.sgml
index 3f139917790..b337f2ee555 100644
--- a/doc/src/sgml/ref/insert.sgml
+++ b/doc/src/sgml/ref/insert.sgml
@@ -594,6 +594,15 @@ INSERT INTO <replaceable class="parameter">table_name</replaceable> [ AS <replac
</para>
</tip>
+ <warning>
+ <para>
+ While <command>CREATE INDEX CONCURRENTLY</command> or <command>REINDEX
+ CONCURRENTLY</command> is running on a unique index, <command>INSERT
+ ... ON CONFLICT</command> statements on the same table may unexpectedly
+ fail with a unique violation.
+ </para>
+ </warning>
+
</refsect2>
</refsect1>
diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c
index da5d901ec3c..4b62a9756c1 100644
--- a/src/backend/optimizer/util/plancat.c
+++ b/src/backend/optimizer/util/plancat.c
@@ -789,6 +789,11 @@ find_relation_notnullatts(PlannerInfo *root, Oid relid)
* the purposes of inference. If no opclass (or collation) is specified, then
* all matching indexes (that may or may not match the default in terms of
* each attribute opclass/collation) are used for inference.
+ *
+ * Note: during index CONCURRENTLY operations, different transactions
+ * may reference different sets of arbiter indexes. This can lead to false
+ * unique constraint violations that wouldn't occur during normal operations.
+ * For more information, see insert.sgml.
*/
List *
infer_arbiter_indexes(PlannerInfo *root)
--
2.43.0