Skip to content

Commit 46524d5

Browse files
committed
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
1 parent d9ffc27 commit 46524d5

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
@@ -703,6 +703,11 @@ get_relation_foreign_keys(PlannerInfo *root, RelOptInfo *rel,
703703
* the purposes of inference. If no opclass (or collation) is specified, then
704704
* all matching indexes (that may or may not match the default in terms of
705705
* each attribute opclass/collation) are used for inference.
706+
*
707+
* Note: during index CONCURRENTLY operations, different transactions may
708+
* reference different sets of arbiter indexes. This can lead to false unique
709+
* constraint violations that wouldn't occur during normal operations. For
710+
* more information, see insert.sgml.
706711
*/
707712
List *
708713
infer_arbiter_indexes(PlannerInfo *root)

0 commit comments

Comments
 (0)