Re: "insert [...] on conflict" hangs on conflict on an unmentioned gist index - Mailing list pgsql-bugs

From Tom Lane
Subject Re: "insert [...] on conflict" hangs on conflict on an unmentioned gist index
Date
Msg-id 1474.1467650281@sss.pgh.pa.us
Whole thread Raw
In response to Re: "insert [...] on conflict" hangs on conflict on an unmentioned gist index  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: "insert [...] on conflict" hangs on conflict on an unmentioned gist index
List pgsql-bugs
I wrote:
> It looks to me like the ON CONFLICT code has exactly zero chance of
> working with non-btree (or more generally, non-amcanunique) indexes.

Nah, I take that back --- I was expecting this to be handled somewhere
else than it is.  It looks like the actual cause is just sloppy
handling of noDupErr in ExecInsertIndexTuples; the attached fixes it
for me.

            regards, tom lane

diff --git a/src/backend/executor/execIndexing.c b/src/backend/executor/execIndexing.c
index c819d19..e73bad3 100644
*** a/src/backend/executor/execIndexing.c
--- b/src/backend/executor/execIndexing.c
*************** ExecInsertIndexTuples(TupleTableSlot *sl
*** 407,413 ****
              bool        violationOK;
              CEOUC_WAIT_MODE waitMode;

!             if (noDupErr)
              {
                  violationOK = true;
                  waitMode = CEOUC_LIVELOCK_PREVENTING_WAIT;
--- 407,413 ----
              bool        violationOK;
              CEOUC_WAIT_MODE waitMode;

!             if (noDupErr && (arbiterIndexes == NIL || arbiter))
              {
                  violationOK = true;
                  waitMode = CEOUC_LIVELOCK_PREVENTING_WAIT;

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #14226: pg_upgrade for 8.4 to 9.4 failed
Next
From: Peter Geoghegan
Date:
Subject: Re: "insert [...] on conflict" hangs on conflict on an unmentioned gist index