Re: Catching unique_violation exception on specific column/index - Mailing list pgsql-general

From Alexey Dokuchaev
Subject Re: Catching unique_violation exception on specific column/index
Date
Msg-id 20180611105834.GA47390@regency.nsu.ru
Whole thread Raw
In response to Re: Catching unique_violation exception on specific column/index  (Thomas Kellerer <spam_eater@gmx.net>)
Responses Re: Catching unique_violation exception on specific column/index  (Andreas Kretschmer <andreas@a-kretschmer.de>)
Re: Catching unique_violation exception on specific column/index  (Thomas Kellerer <spam_eater@gmx.net>)
List pgsql-general
On Mon, Jun 11, 2018 at 12:30:13PM +0200, Thomas Kellerer wrote:
> Alexey Dokuchaev schrieb am 11.06.2018 um 12:10:
> > I have a table with several UNIQUE and CHECK constraints.  One of these
> > UNIQUE constraints actually *can* be violated -- not on the table level,
> > of course, but on the application level -- meaning, if the entry with
> > particular foo_key is already in there, do not throw an exception, just
> > silently do nothing.
>  
> What's wrong with:
> 
>   INSERT ...
>   ON CONFLICT (foo_key) DO NOTHING

Nothing I guess, except that it is available since 9.5 (right?), and I try
to stay compatible with 9.3.  Sorry for not saying this in the first place.

./danfe


pgsql-general by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: Catching unique_violation exception on specific column/index
Next
From: Thomas Kellerer
Date:
Subject: Re: Catching unique_violation exception on specific column/index