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

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tomas Vondra <tv(at)fuzzy(dot)cz>
Cc: tigran(dot)mkrtchyan(at)desy(dot)de, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6300: duplicate key value violates unique constraint
Date: 2011-11-23 02:49:48
Message-ID: CA+TgmoZc2g-QP9p5=d=zhTzsRVYO+DF1TA6PT_SrJo4KjBLOJw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Nov 18, 2011 at 3:52 PM, Tomas Vondra <tv(at)fuzzy(dot)cz> wrote:
>> Then let me re-phrase it:
>>
>> I think it's a bug to log with level ERROR absolute valid SQL
>> statement. You have error code returned to the client to handle it. If
>> I want to log statements then I can turned that on.  This is client
>> appication debuggging and to error handling.
>
> The SQL command may be syntactically correct, but breaking a UNIQUE
> constraint is an error condition and therefore it's handled like an error
> condition - the user receives an exception and a message with ERROR level
> is written to the log.

While this is obviously not a bug, the need to distinguish "scary"
error messages from "non-scary" error messages is one that we've
discussed before and still haven't found a good solution to. We
report this as an ERROR:

duplicate key value violates unique constraint "%s"

We also report this as an ERROR:

xlog flush request %X/%X is not satisfied --- flushed only to %X/%X

There is no sort of systematic labeling of error messages in the log
to enable the DBA to figure out that the first error message is likely
nothing more serious than an integrity constraint doing its bit to
preserve data integrity, while the second is likely a sign of
impending disaster. And not just figure it out, but filter out the
stuff that's actually worth worrying about and alert on it. If the
first error message shows up in the log of a server I'm administering,
IDC. If the second one shows up, I want to be woken up in the middle
of the night immediately, and for that matter let's page the back-up
on call while we're at it. Right now, the best option is probably to
use something like tail_n_mail which, IIRC, has lots of hardcoded
error strings in it to help separate the wheat from the chaff, but
that's just a workaround for our failure to classify things properly.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message nadhiya 2011-11-23 06:02:05 BUG #6305: cann't reinstall postgresql
Previous Message Robert Balser 2011-11-22 21:18:12 BUG #6304: initdb fails with loale ko_KR.eucKR