From: | Ron Clarke <rclarkeai(at)gmail(dot)com> |
---|---|
To: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: More than one UNIQUE key when matching items.. |
Date: | 2021-03-22 13:11:08 |
Message-ID: | CAGVf-sO5WmJvYveWknoa8fuz=iX1Jy8c0HTdVjoKowZUyHfpOA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thank you, simple, and effective. Got sucked into trying to use a named
constraint.
Best regards
Ron
On Sat, 20 Mar 2021 at 20:00, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> wrote:
> 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
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Ron Clarke | 2021-03-22 13:22:43 | Re: More than one UNIQUE key when matching items.. |
Previous Message | Saurabh Agrawal | 2021-03-22 10:11:13 | Re: Need help on query optimization |