Re: BUG #14526: no unique or exclusion constraint matching the ON CONFLICT

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tiago Babo <tiago(dot)babo(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14526: no unique or exclusion constraint matching the ON CONFLICT
Date: 2017-02-08 01:41:31
Message-ID: CAH2-Wzm5RB4H=yiZBJJ5ONQOECb15=KjkS=ZC+r8j56OhTLNhg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Feb 7, 2017 at 3:57 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> btw ... not relevant to this particular complaint, but I notice that
> infer_arbiter_indexes will accept an index that is indisvalid and
> indisunique, but should it be checking indimmediate as well? That is,
> does the ON CONFLICT code work if the uniqueness checks are deferred?
> I could not find any regression tests exercising such a case.

It won't work with deferrable constraints (even when immediate
enforcement is in effect, so obscure reasons). Enforcement occurs in
the executor -- see ExecCheckIndexConstraints().

You may recall that I wrote a refactoring patch that attempted to make
the situation clearer, which Heikki didn't like. Currently, the
constant UNIQUE_CHECK_PARTIAL is sort of overloaded to also be used
with speculative insertion, which, aside from being ugly, has various
minor practical disadvantages.

--
Peter Geoghegan

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Geoghegan 2017-02-08 01:48:14 Re: BUG #14526: no unique or exclusion constraint matching the ON CONFLICT
Previous Message Tom Lane 2017-02-08 00:16:51 Re: BUG #14526: no unique or exclusion constraint matching the ON CONFLICT