mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
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
This commit is contained in:
@ -269,7 +269,7 @@ RestoreParamList(char **start_address)
|
||||
* can contain NULLs for any unknown individual values. NULL can be given if
|
||||
* no parameters are known.
|
||||
*
|
||||
* If maxlen is not zero, that's the maximum number of bytes of any one
|
||||
* If maxlen is >= 0, that's the maximum number of bytes of any one
|
||||
* parameter value to be printed; an ellipsis is added if the string is
|
||||
* longer. (Added quotes are not considered in this calculation.)
|
||||
*/
|
||||
|
Reference in New Issue
Block a user