Re: "INSERT ON CONFLICT UPDATE" - Use of indexes ?

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Laura Smith <n5d9xq3ti233xiyif2vp(at)protonmail(dot)ch>
Cc: postgre <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: "INSERT ON CONFLICT UPDATE" - Use of indexes ?
Date: 2020-06-08 22:55:12
Message-ID: CAApHDvqmSvaFUtNbMTtGOdbNjszimZ-B=eorXYtMb52+T6vP4A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 9 Jun 2020 at 00:42, Laura Smith
<n5d9xq3ti233xiyif2vp(at)protonmail(dot)ch> wrote:
> What'st the current state of play with indexes and ON CONFLICT ? The docs seem to vaguely suggest it is possible, but this 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 it in 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2020-06-08 23:09:53 Re: Is it possible to use keywords (date units) in a function definition?
Previous Message Adrian Klaver 2020-06-08 22:40:05 Re: Is it possible to use keywords (date units) in a function definition?