From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Alexey Bashtanov <bashtanov@imap.cc>
To: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: log bind parameter values on error
Date: Thu, 17 Jan 2019 09:41:50 +0100
Message-ID: <96007f6e-1e42-e454-9db4-e7842e137508@2ndquadrant.com> (raw)
In-Reply-To: <084a044f-9d77-b931-0658-5d871df8a2f8@imap.cc>
References: <0146a67b-a22a-0519-9082-bc29756b93a2@imap.cc>
<c4891f99-8385-5c31-1aac-e226356ec964@2ndquadrant.com>
<ad08f6a3-e38c-f851-a5a2-0bf68d1d7f72@imap.cc>
<896ac2ed-7735-1f24-d877-3249b38bb6fe@2ndquadrant.com>
<8efd95fe-3886-61f0-0faa-6c661cd2f874@imap.cc>
<084a044f-9d77-b931-0658-5d871df8a2f8@imap.cc>
There appears to be a problem with how this affects current logging
behavior.
I'm using
pgbench -M extended -S -T 10 bench
to test the extended protocol.
Unpatched, with log_statement=all, you get something like
LOG: execute <unnamed>: SELECT abalance FROM pgbench_accounts WHERE aid
= $1;
DETAIL: parameters: $1 = '30223'
With your patch, with log_statement=all and log_parameters=on, you get
the same, but with log_statement=all and log_parameters=off you get
LOG: execute <unnamed>: SELECT abalance FROM pgbench_accounts WHERE aid
= $1;
DETAIL: parameters: $1 = UNKNOWN TYPE
We should probably keep the existing parameter logging working as before.
This also raises the question of the new parameter name. Parameters are
already logged. So the name should perhaps be more like
log_parameters_on_error.
Some API notes on your patch: I think you can change
get_portal_bind_parameters() to take a ParamListInfo, since you're not
doing anything with the Portal other than grab the parameters. And that
would allow you to keep the signature of errdetail_params() unchanged.
I did some performance tests using the commands shown above and didn't
find any problems. Obviously the default pgbench stuff isn't very
parameter-intensive. Do you have tests with more and larger parameter
values?
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
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: peter.eisentraut@2ndquadrant.com, bashtanov@imap.cc
Subject: Re: log bind parameter values on error
In-Reply-To: <96007f6e-1e42-e454-9db4-e7842e137508@2ndquadrant.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