From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Improve user control over truncation of logged bind-parameter va
Date: Thu, 02 Apr 2020 19:04:59 +0000
Message-ID: <E1jK599-0004hg-8V@gemulon.postgresql.org> (raw)
Improve user control over truncation of logged bind-parameter values.
This patch replaces the boolean GUC log_parameters_on_error introduced
by commit ba79cb5dc with an integer log_parameter_max_length_on_error,
adding the ability to specify how many bytes to trim each logged
parameter value to. (The previous coding hard-wired that choice at
64 bytes.)
In addition, add a new parameter log_parameter_max_length that provides
similar control over truncation of query parameters that are logged in
response to statement-logging options, as opposed to errors. Previous
releases always logged such parameters in full, possibly causing log
bloat.
For backwards compatibility with prior releases,
log_parameter_max_length defaults to -1 (log in full), while
log_parameter_max_length_on_error defaults to 0 (no logging).
Per discussion, log_parameter_max_length is SUSET since the DBA should
control routine logging behavior, but log_parameter_max_length_on_error
is USERSET because it also affects errcontext data sent back to the
client.
Alexey Bashtanov, editorialized a little by me
Discussion: https://postgr.es/m/b10493cc-a399-a03a-67c7-068f2791ee50@imap.cc
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/0b34e7d307e6a142ee94800e6d5f3e73449eeffd
Modified Files
--------------
doc/src/sgml/config.sgml | 62 +++++++++++++-----
src/backend/nodes/params.c | 2 +-
src/backend/tcop/postgres.c | 57 ++++++++++------
src/backend/utils/mb/stringinfo_mb.c | 6 +-
src/backend/utils/misc/guc.c | 34 +++++++---
src/backend/utils/misc/postgresql.conf.sample | 7 +-
src/bin/pgbench/t/001_pgbench_with_server.pl | 93 ++++++++++++++++++++++++---
src/include/utils/guc.h | 5 +-
src/pl/plpgsql/src/pl_exec.c | 4 +-
9 files changed, 207 insertions(+), 63 deletions(-)
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Improve user control over truncation of logged bind-parameter va
In-Reply-To: <E1jK599-0004hg-8V@gemulon.postgresql.org>
References: <E1jK599-0004hg-8V@gemulon.postgresql.org>
* 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