pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: Catching unique_violation exception on specific column/index
Date: Mon, 11 Jun 2018 13:26:16 +0200
Message-ID: <6ccb6712-33bb-2f42-c16f-378a337160b6@gmx.net> (raw)
In-Reply-To: <20180611105834.GA47390@regency.nsu.ru>
References: <20180611101033.GA40332@regency.nsu.ru>
	<0fa3bd50-3ce2-2038-29da-48fa0a1f6b19@gmx.net>
	<20180611105834.GA47390@regency.nsu.ru>

Alexey Dokuchaev schrieb am 11.06.2018 um 12:58:
>>> 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.

Andreas already mentioned that 9.3 will be EOL soon (3 months from now), but 
the performance and efficiency for concurrent execution of ON CONFLICT is 
much better than anything you can implement yourself. 

If that functionality is an important part of your code, you should consider 
upgrading to 10 (or 9.6 if your are really conservative) rather sooner
than later. 






view thread (8+ messages)  latest in thread

Message-ID: <6ccb6712-33bb-2f42-c16f-378a337160b6@gmx.net>
Permalink:  ../6ccb6712-33bb-2f42-c16f-378a337160b6@gmx.net/
Also on:    postgresql.org/message-id/6ccb6712-33bb-2f42-c16f-378a337160b6@gmx.net

 · 

reply

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: spam_eater@gmx.net
  Subject: Re: Catching unique_violation exception on specific column/index
  In-Reply-To: <6ccb6712-33bb-2f42-c16f-378a337160b6@gmx.net>
  References: <20180611101033.GA40332@regency.nsu.ru> <0fa3bd50-3ce2-2038-29da-48fa0a1f6b19@gmx.net> <20180611105834.GA47390@regency.nsu.ru> <6ccb6712-33bb-2f42-c16f-378a337160b6@gmx.net>

* 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