Re: log bind parameter values on error

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: log bind parameter values on error
Дата
Msg-id b1b68453-9756-bd92-306e-a29fc5ad7cd7@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: log bind parameter values on error  (Alexey Bashtanov <bashtanov@imap.cc>)
Ответы Re: log bind parameter values on error  (Alexey Bashtanov <bashtanov@imap.cc>)
Список pgsql-hackers
On 2019-03-29 15:55, Alexey Bashtanov wrote:
>> ERROR:  value "62812" is out of range for type smallint
>> STATEMENT:  SELECT abalance FROM pgbench_accounts WHERE aid = $1;
>>
>> (In this case the error message contains the parameter value, so it's
>> not a very practical case, but it should work, it seems.)
> I guess this error occurred /while/ binding, so the parameters probably
> weren't yet all bound by the time of error reporting.
> That's why the error message came without parameters.

I see.  But I think that could be fixed.  Change exec_bind_message() to
loop over the parameters twice: once to save them away, once to actually
process them.  I think the case of a faulty input value is probably very
common, so it would be confusing if that didn't work.

I think this patch needs some tests.  Manually testing it is cumbersome,
and as we are seeing now, it is not quite clear which cases it is
supposed to cover.  There are also additional cases for binary
parameters, and there are additions to the CSV output format.  We need
tests for all that so the behavior explains itself and doesn't have to
be rediscovered every time someone wants to look at this again.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: pg_rewind vs superuser
Следующее
От: Amit Khandekar
Дата:
Сообщение: Re: Minimal logical decoding on standbys