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