Re: [PATCH]: Allow errors in parameter values to be reported during the BIND phase itself..

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Alexey Bashtanov <bashtanov(at)imap(dot)cc>, Franck Verrot <franck(at)verrot(dot)fr>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH]: Allow errors in parameter values to be reported during the BIND phase itself..
Date: 2021-03-16 01:18:59
Message-ID: 20210316011859.GC29463@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2021-03-16 01:27:55 Re: shared-memory based stats collector
Previous Message Michael Paquier 2021-03-16 01:00:37 Re: Improvements and additions to COPY progress reporting