Re: [BUGS] BUG #14526: no unique or exclusion constraint matching theON CONFLICT - Mailing list pgsql-bugs

From Peter Geoghegan
Subject Re: [BUGS] BUG #14526: no unique or exclusion constraint matching theON CONFLICT
Date
Msg-id CAH2-Wz=J+AtQg5xEm3y6GUO=KfzqsfKy89Vzn0-NayjkF_baVw@mail.gmail.com
Whole thread Raw
In response to Re: [BUGS] BUG #14526: no unique or exclusion constraint matching the ON CONFLICT  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [BUGS] BUG #14526: no unique or exclusion constraint matching theON CONFLICT  (Tiago Babo <tiago.babo@gmail.com>)
List pgsql-bugs
On Tue, Feb 7, 2017 at 12:44 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Hm.  I looked at infer_arbiter_indexes, which is the place where this
> particular error is thrown, and realized that my previous assertion
> was wrong: it *does* try to prove applicability of partial indexes
> based on the ON CONFLICT WHERE clause.

I must have misunderstood. ON CONFLICT accepts a WHERE clause as part
of the inference specification itself entirely because that is
sometimes useful.

> So actually it should be
> deciding that uniq_person_accounts is a usable unique index --- at
> least, if you always have "WHERE type = 'PersonAccount'" in the
> ON CONFLICT clause.  Maybe you're sometimes leaving that out?

That's the simplest answer. Tiago?

-- 
Peter Geoghegan


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: [BUGS] BUG #14526: no unique or exclusion constraint matching the ON CONFLICT
Next
From: Tiago Babo
Date:
Subject: Re: [BUGS] BUG #14526: no unique or exclusion constraint matching theON CONFLICT