Skip to content

Commit 0a679b9

Browse files
nmischCommitfest Bot
authored andcommitted
Doc: cover index CONCURRENTLY causing errors in INSERT ... ON CONFLICT.
Author: Mikhail Nikalayeu <[email protected]> Reviewed-by: Noah Misch <[email protected]> Discussion: https://postgr.es/m/CANtu0ojXmqjmEzp-=aJSxjsdE76iAsRgHBoK0QtYHimb_mEfsg@mail.gmail.com Backpatch-through: 13
1 parent cf8be02 commit 0a679b9

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

doc/src/sgml/ref/insert.sgml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,15 @@ INSERT INTO <replaceable class="parameter">table_name</replaceable> [ AS <replac
594594
</para>
595595
</tip>
596596

597+
<warning>
598+
<para>
599+
While <command>CREATE INDEX CONCURRENTLY</command> or <command>REINDEX
600+
CONCURRENTLY</command> is running on a unique index, <command>INSERT
601+
... ON CONFLICT</command> statements on the same table may unexpectedly
602+
fail with a unique violation.
603+
</para>
604+
</warning>
605+
597606
</refsect2>
598607
</refsect1>
599608

src/backend/optimizer/util/plancat.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,11 @@ find_relation_notnullatts(PlannerInfo *root, Oid relid)
789789
* the purposes of inference. If no opclass (or collation) is specified, then
790790
* all matching indexes (that may or may not match the default in terms of
791791
* each attribute opclass/collation) are used for inference.
792+
*
793+
* Note: during index CONCURRENTLY operations, different transactions
794+
* may reference different sets of arbiter indexes. This can lead to false
795+
* unique constraint violations that wouldn't occur during normal operations.
796+
* For more information, see insert.sgml.
792797
*/
793798
List *
794799
infer_arbiter_indexes(PlannerInfo *root)

0 commit comments

Comments
 (0)