Re: BUG #6300: duplicate key value violates unique constraint

From: Alex Hunsaker <badalex(at)gmail(dot)com>
To: tigran(dot)mkrtchyan(at)desy(dot)de
Cc: Tomas Vondra <tv(at)fuzzy(dot)cz>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6300: duplicate key value violates unique constraint
Date: 2011-11-18 23:10:11
Message-ID: CAFaPBrTBF6dF1wuBtSkzU1micTgyuY80JgxPkXYu4Ojfa8qf3Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Nov 18, 2011 at 14:31, Tigran Mkrtchyan
<tigran(dot)mkrtchyan(at)desy(dot)de> wrote:
>
> On Fri, Nov 18, 2011 at 9:52 PM, Tomas Vondra <tv(at)fuzzy(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message lindebg 2011-11-18 23:19:54 Re: BUG #6299: pg_dump, pg_dumpall - Problem with the order of backup functions
Previous Message Josh Kupershmidt 2011-11-18 22:11:37 Re: BUG #6301: extra space in psql variable expansion