From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Ron Clarke <rclarkeai@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: More than one UNIQUE key when matching items..
Date: Sat, 20 Mar 2021 21:00:13 +0100
Message-ID: <7d1d877d122bc59dceddd687f37fb674175078dd.camel@cybertec.at> (raw)
In-Reply-To: <CAGVf-sM3mMY3t3a64EfGbK6UN_Qibbye7N52E_58eF4eNgzB_Q@mail.gmail.com>
References: <CAGVf-sM3mMY3t3a64EfGbK6UN_Qibbye7N52E_58eF4eNgzB_Q@mail.gmail.com>
On Sat, 2021-03-20 at 15:51 +0000, Ron Clarke wrote:
> In SQL Server this is easy, we insert the records into a temporary table with separate Unique
> indexes on the id for set a and the ids for set b and put the 'ignore_dup_key' on which tells
> SQL Server to ignore duplicate rows and carry on.
>
> The nearest to this at first appears to be the ON CONFLICT ON CONSTRAINT IGNORE in Postgres.
> But this only works with a single constraint, at a time i.e. we can't set the ON CONFLICT ON
> CONSTRAINT IGNORE to work with multiple UNIQUE indexes.
You can try this:
INSERT ... ON CONFLICT DO NOTHING;
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: laurenz.albe@cybertec.at, rclarkeai@gmail.com
Subject: Re: More than one UNIQUE key when matching items..
In-Reply-To: <7d1d877d122bc59dceddd687f37fb674175078dd.camel@cybertec.at>
References: <CAGVf-sM3mMY3t3a64EfGbK6UN_Qibbye7N52E_58eF4eNgzB_Q@mail.gmail.com> <7d1d877d122bc59dceddd687f37fb674175078dd.camel@cybertec.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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