From: Justin Pryzby <pryzby@telsasoft.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Alexey Bashtanov <bashtanov@imap.cc>
Cc: Franck Verrot <franck@verrot.fr>
Cc: pgsql-hackers@postgresql.org
Subject: Re: [PATCH]: Allow errors in parameter values to be reported during the BIND phase itself..
Date: Mon, 15 Mar 2021 20:18:59 -0500
Message-ID: <20210316011859.GC29463@telsasoft.com> (raw)
In-Reply-To: <3140512.1615854618@sss.pgh.pa.us>
References: <20210104170939.GH9712@telsasoft.com>
<3087634.1615848349@sss.pgh.pa.us>
<20210315224945.GB29463@telsasoft.com>
<3140512.1615854618@sss.pgh.pa.us>
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 instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: pryzby@telsasoft.com, tgl@sss.pgh.pa.us, alvherre@alvh.no-ip.org, bashtanov@imap.cc, franck@verrot.fr
Subject: Re: [PATCH]: Allow errors in parameter values to be reported during the BIND phase itself..
In-Reply-To: <20210316011859.GC29463@telsasoft.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox