postgres.git / summary / log / commit / refs

commit    438ccd33a37a9c3bf77fbe5424c1c0a1acb769e4
Author:   Noah Misch <noah@leadboat.com>
Date:     Mon Nov 03 20:57:09 2025 +0000
First released in: 13.23, 14.20, 15.15, 16.11, 17.7, 18.1
Reverted by: 758479213d57

    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 1aa7a7ecbac..1c358b984ae 100644 --- a/doc/src/sgml/ref/insert.sgml +++ b/doc/src/sgml/ref/insert.sgml @@ -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> diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c index 3b1ada1127e..47169e81d12 100644 --- a/src/backend/optimizer/util/plancat.c +++ b/src/backend/optimizer/util/plancat.c @@ -627,6 +627,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) [parent: 78d542b2bc0a]