pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feed"INSERT ON CONFLICT UPDATE" - Use of indexes ?
4+ messages / 4 participants
[nested] [flat]
* "INSERT ON CONFLICT UPDATE" - Use of indexes ?
@ 2020-06-08 12:42 Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch>
2020-06-08 13:14 ` Re: "INSERT ON CONFLICT UPDATE" - Use of indexes ? Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-08 13:20 ` Re: "INSERT ON CONFLICT UPDATE" - Use of indexes ? Thomas Kellerer <shammat@gmx.net>
2020-06-08 22:55 ` Re: "INSERT ON CONFLICT UPDATE" - Use of indexes ? David Rowley <dgrowleyml@gmail.com>
0 siblings, 3 replies; 4+ messages in thread
From: Laura Smith @ 2020-06-08 12:42 UTC (permalink / raw)
To: postgre <pgsql-general@lists.postgresql.org>
Hi,
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
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: "INSERT ON CONFLICT UPDATE" - Use of indexes ?
2020-06-08 12:42 "INSERT ON CONFLICT UPDATE" - Use of indexes ? Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch>
@ 2020-06-08 13:14 ` Adrian Klaver <adrian.klaver@aklaver.com>
2 siblings, 0 replies; 4+ messages in thread
From: Adrian Klaver @ 2020-06-08 13:14 UTC (permalink / raw)
To: Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch>; postgre <pgsql-general@lists.postgresql.org>
On 6/8/20 5:42 AM, Laura Smith wrote:
> Hi,
>
> 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
>
The above is going to need more information:
1) Table definition.
2) Actual index definition
3) Complete ON CONFLICT definition
4) Error message returned.
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: "INSERT ON CONFLICT UPDATE" - Use of indexes ?
2020-06-08 12:42 "INSERT ON CONFLICT UPDATE" - Use of indexes ? Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch>
@ 2020-06-08 13:20 ` Thomas Kellerer <shammat@gmx.net>
2 siblings, 0 replies; 4+ messages in thread
From: Thomas Kellerer @ 2020-06-08 13:20 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Laura Smith schrieb am 08.06.2020 um 14:42:
> Hi,
>
> 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
If c1 and c2 make up a unique index, then
ON CONFLICT (c1, c2)
works
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: "INSERT ON CONFLICT UPDATE" - Use of indexes ?
2020-06-08 12:42 "INSERT ON CONFLICT UPDATE" - Use of indexes ? Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch>
@ 2020-06-08 22:55 ` David Rowley <dgrowleyml@gmail.com>
2 siblings, 0 replies; 4+ messages in thread
From: David Rowley @ 2020-06-08 22:55 UTC (permalink / raw)
To: Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch>; +Cc: postgre <pgsql-general@lists.postgresql.org>
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, 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
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2020-06-08 22:55 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-06-08 12:42 "INSERT ON CONFLICT UPDATE" - Use of indexes ? Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch>
2020-06-08 13:14 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-08 13:20 ` Thomas Kellerer <shammat@gmx.net>
2020-06-08 22:55 ` David Rowley <dgrowleyml@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox