Re: control max length of parameter values logged

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Alexey Bashtanov <bashtanov(at)imap(dot)cc>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: control max length of parameter values logged
Date: 2020-04-01 04:36:59
Message-ID: 20200401043659.GK14618@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Wed, Apr 01, 2020 at 01:52:48AM +0100, Alexey Bashtanov wrote:
> +++ b/doc/src/sgml/config.sgml
> + <varlistentry id="guc-log-parameter-max-length" xreflabel="log_parameter_max_length">
> + <term><varname>log_parameter_max_length</varname> (<type>integer</type>)
> + <indexterm>
> + <primary><varname>log_parameter_max_length</varname> configuration parameter</primary>
> + </indexterm>
> + </term>
> + <listitem>
> + <para>
> + If greater than zero, bind parameter values reported in non-error
> + statement-logging messages are trimmed to no more than this many bytes.

Can I suggest to say:

"Limit bind parameter values reported by non-error statement-logging messages
to this many bytes". Or,

"The maximum length of bind parameter values to log with non-error
statement-logging messages".

> --- a/src/backend/utils/misc/guc.c
> +++ b/src/backend/utils/misc/guc.c
> @@ -2855,6 +2857,28 @@ static struct config_int ConfigureNamesInt[] =
> NULL, NULL, NULL
> },
>
> + {
> + {"log_parameter_max_length", PGC_SUSET, LOGGING_WHAT,
> + gettext_noop("When logging statements, limit logged parameter values to first N bytes."),
> + gettext_noop("Zero to print values in full."),

Could you make zero a normal value and -1 the "special" value to disable
trimming ?

Setting to zero will avoid displaying parameters at all, setting to -1 wil
display values in full.

Cheers,
--
Justin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2020-04-01 04:53:04 wraparound dangers in snapshot too old
Previous Message movead.li@highgo.ca 2020-04-01 03:59:39 Re: A bug when use get_bit() function for a long bytea string