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

Jan Kundrát <jkt@flaska.net>

From: Jan Kundrát <jkt@flaska.net>
To: "Dickson S. Guedes" <listas@guedesoft.net>
Cc: pgsql-hackers@postgresql.org, Robert Haas <robertmhaas@gmail.com>, jose.arthur@gmail.com
Date: 2011-11-10T11:46:36Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Don't assume that a tuple's header size is unchanged during toasting.

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/