Re: "INSERT ON CONFLICT UPDATE" - Use of indexes ? - Mailing list pgsql-general

From David Rowley
Subject Re: "INSERT ON CONFLICT UPDATE" - Use of indexes ?
Date
Msg-id CAApHDvqmSvaFUtNbMTtGOdbNjszimZ-B=eorXYtMb52+T6vP4A@mail.gmail.com
Whole thread Raw
In response to "INSERT ON CONFLICT UPDATE" - Use of indexes ?  (Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch>)
List pgsql-general
On Tue, 9 Jun 2020 at 00:42, Laura Smith
<n5d9xq3ti233xiyif2vp@protonmail.ch> wrote:
> What'st the current state of play with indexes and ON CONFLICT ?  The docs seem to vaguely suggest it is possible,
butthis SO question (https://stackoverflow.com/questions/38945027/) seems to suggest it is not.
 
>
> I've got a unique named index on a table (i.e. "create unique index xyz...") but I cannot seem to be able to refer to
itin a function ?
 
> ON CONFLICT (index_name) .... : does not work
> ON CONFLICT ON CONSTRAINT index_name....: does not work

Creating a unique index does not create a unique constraint.  If you
create a unique constraint, it'll create a unique index to enforce the
constraint.  ON CONSTRAINT requires a constraint name, not an index
name.

David



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Is it possible to use keywords (date units) in a functiondefinition?
Next
From: "David G. Johnston"
Date:
Subject: Re: Is it possible to use keywords (date units) in a function definition?