Re: Re: [patch] Include detailed information about a row failing a CHECK constraint into the error message

From: Jan Kundrát <jkt(at)flaska(dot)net>
To: "Dickson S(dot) Guedes" <listas(at)guedesoft(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org, Robert Haas <robertmhaas(at)gmail(dot)com>, jose(dot)arthur(at)gmail(dot)com
Subject: Re: Re: [patch] Include detailed information about a row failing a CHECK constraint into the error message
Date: 2011-11-10 11:46:36
Message-ID: 4EBBB99C.70306@flaska.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/10/11 12:41, Dickson S. Guedes wrote:
>> jkt=> UPDATE tbl SET a = -a;
>> ERROR: new row for relation "tbl" violates check constraint "tbl_a_check"
>> DETAIL: New row with data (x, -10) violates check constraint "tbl_a_check".
>>
>> The last line, the detailed error message, is added by the patch.
>
> The patch uses 'New row with data ....' but it was an UPDATE, if you
> go further with this patch, IMO the message should be fixed too.

I'm not sure whether the code can determine whether the check gets
triggered by an UPDATE or an INSERT (both commands lead to this code
path). Please note that the already-existing error message (the "ERROR:
" line in the output I enclosed) already uses the phrase "new row".

That said, I'll of course be more than happy to include whatever string
which fits better, and am open to any suggestions.

Cheers,
Jan

--
Trojita, a fast e-mail client -- http://trojita.flaska.net/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikhil Sontakke 2011-11-10 12:00:17 Re: Concurrent CREATE TABLE/DROP SCHEMA leaves inconsistent leftovers
Previous Message Dickson S. Guedes 2011-11-10 11:41:00 Re: Re: [patch] Include detailed information about a row failing a CHECK constraint into the error message