]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Doc: cover index CONCURRENTLY causing errors in INSERT ... ON CONFLICT.
authorNoah Misch <noah@leadboat.com>
Mon, 3 Nov 2025 20:57:09 +0000 (12:57 -0800)
committerNoah Misch <noah@leadboat.com>
Mon, 3 Nov 2025 20:57:13 +0000 (12:57 -0800)
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
src/backend/optimizer/util/plancat.c

index 6f0adee1a124ab1bf17164d338b32bafce55eacf..954ee3af3a12151e1f4b076f5d84cbbd29a14550 100644 (file)
@@ -556,6 +556,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>
 
index 002cea0c1162ab6eb46b314eaebc41e7f663996f..b0eabeac058af0d2b66fc41448e89bd43da9aaef 100644 (file)
@@ -637,6 +637,11 @@ get_relation_foreign_keys(PlannerInfo *root, RelOptInfo *rel,
  * 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)