On Mon, Mar 15, 2021 at 08:30:18PM -0400, Tom Lane wrote:
> +               /* Pop the error callback */
> +               error_context_stack = error_context_stack->previous;
> +
>                 /*
>                  * Once all parameters have been received, prepare for 
> printing them
>                  * in errors, if configured to do so.  (This is saved in the 
> portal,
>                  * so that they'll appear when the query is executed later.)
>                  */
>                 if (log_parameter_max_length_on_error != 0)
>                         params->paramValuesStr =
>                                 BuildParamLogString(params,
...

I think it's somewhat confusing that there's two callbacks.
The first one applies only during typinput/typreceive.
I guess the 2nd one should say that they're printed "in *future errors".

> +# Check that errors are reported during BIND phase, too

Actually, the v13 log_parameter_max_length_on_error feature works during BIND
too, but only after typinput of *all* params.

For example, this shows params when failing in GetCachedPlan().

| python3.5 -c "import pg,time; db=pg.DB('dbname=postgres 
host=/var/run/postgresql port=5432 host=/tmp'); q = db.query(\"SET 
backtrace_functions=pg_strtoint16; SET 
log_parameter_max_length_on_error=-1;\"); db.prepare('p', 'SELECT a::smallint 
from (select \$1 a)a'); db.query_prepared('p',66666);"

So my own description of the patch evolved from "show errors during BIND" to
"show errors during typinput of text params".

Thanks,
-- 
Justin


Reply via email to