Re: BUG #6300: duplicate key value violates unique constraint - Mailing list pgsql-bugs

From Alex Hunsaker
Subject Re: BUG #6300: duplicate key value violates unique constraint
Date
Msg-id CAFaPBrTBF6dF1wuBtSkzU1micTgyuY80JgxPkXYu4Ojfa8qf3Q@mail.gmail.com
Whole thread Raw
In response to Re: BUG #6300: duplicate key value violates unique constraint  (Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>)
List pgsql-bugs
On Fri, Nov 18, 2011 at 14:31, Tigran Mkrtchyan
<tigran.mkrtchyan@desy.de> wrote:
>
> On Fri, Nov 18, 2011 at 9:52 PM, Tomas Vondra <tv@fuzzy.cz> wrote:

> > Anyway this definitely is not a bug,
>
> Still not convinced.

You are unlikely to convince anyone here otherwise... Its works that
way by design.

>  [...] I don't think you will be happy of /var/log/messages will be
> full of error messages when a user tries to create an existing file.
> Well, of course I can check myself the file exists, but why I need DB
> transactions if my application have to take care about that.

If you don't want them logged you could 'catch' them by creating a
wrapper function in plpsql, something like:
http://www.postgresql.org/docs/9.1/interactive/plpgsql-control-structures.html#PLPGSQL-UPSERT-EXAMPLE

pgsql-bugs by date:

Previous
From: Tigran Mkrtchyan
Date:
Subject: Re: BUG #6300: duplicate key value violates unique constraint
Next
From: lindebg@gmail.com
Date:
Subject: Re: BUG #6299: pg_dump, pg_dumpall - Problem with the order of backup functions