public inbox for [email protected]
help / color / mirror / Atom feedFrom: Fujii Masao <[email protected]>
To: Jim Jones <[email protected]>
Cc: Maxym Kharchenko <[email protected]>
Cc: Kirill Reshke <[email protected]>
Cc: Álvaro Herrera <[email protected]>
Cc: Fujii Masao <[email protected]>
Cc: Kirill Gavrilov <[email protected]>
Cc: Andrey M. Borodin <[email protected]>
Cc: Euler Taveira <[email protected]>
Cc: [email protected]
Subject: Re: Truncate logs by max_log_size
Date: Fri, 3 Jul 2026 09:56:04 +0900
Message-ID: <CAHGQGwFOV+7nOdfoO=kfVH=-fRA9aQE1YcHHLYty3nfQ9rQ4RA@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
<CALdSSPh6i4mDZ7TLy7dibSfmDQkzFt5NTqv_QrnhPOFEm2xseg@mail.gmail.com>
<[email protected]>
<CAHGQGwGEd=PpVWDd05bYM8F6mnxcSNmWL2Ei8JCf5azZSJnYJA@mail.gmail.com>
<[email protected]>
<CAHGQGwEc5Dn5KFU04sDp0Kyai2Te5yTuni3QW7pc2a3=343tJQ@mail.gmail.com>
<[email protected]>
<CAHGQGwGVxV1YbtLCT+q1yHejBKjLz7L+8r3WJMW=72SDJFW27g@mail.gmail.com>
<CACsxBjB5+HLw6jJ17qR5vSg+kBb2G5ACSbd_ytZ0HvvD22JqkQ@mail.gmail.com>
<CAHGQGwFYxCVmL4Bvm61bUW+WUi+YXFHzXo9hFEoSgYT1=fU-+w@mail.gmail.com>
<[email protected]>
<[email protected]>
<[email protected]>
<CAHGQGwHJHCi=4zEyMc4GJWPC9-oQZHj+9kncxS2442V9PXGgoQ@mail.gmail.com>
<[email protected]>
On Fri, Jul 3, 2026 at 3:47 AM Jim Jones <[email protected]> wrote:
>
> Hi Fujii
>
> On 02/07/2026 17:49, Fujii Masao wrote:
> > I reviewed the patch again and made a few additional changes. The updated
> > patch is attached. Barring any objections, I'm thinking to commit it.
>
>
> The changes seem reasonable to me.
> Thanks for taking care of it!
Thanks for the review! I've pushed the patch.
While working on it, I found a few possible follow-up improvements.
(1)
When log_statement is enabled, executing a prepared statement logs the
prepared query in a DETAIL message. For example:
=# SET log_statement_max_length TO 10;
=# PREPARE test AS SELECT * FROM pgbench_accounts WHERE aid = $1;
LOG: statement: PREPARE te
=# EXECUTE test(1);
LOG: statement: EXECUTE te
DETAIL: prepare: PREPARE test AS SELECT * FROM pgbench_accounts
WHERE aid = $1;
Should log_statement_max_length also apply to such query string in the
DETAIL message?
(2)
When a bind parameter is truncated by
log_parameter_max_length, an ellipsis (...) is appended:
=# SET log_parameter_max_length TO 5;
=# SELECT $1::text \bind 'abcdefghijk' \g
LOG: execute <unnamed>: SELECT $1::text
DETAIL: Parameters: $1 = 'abcde...'
Would it make sense for log_statement_max_length to append an
ellipsis as well, so that users can easily tell when a statement has
been truncated?
(3)
+ query_len = strlen(query);
truncate_query_log() uses strlen() only to determine whether the
query exceeds log_statement_max_length. Since the query can be very
large, would it be better to use
strnlen(query, log_statement_max_length + MAX_MULTIBYTE_CHAR_LEN)
instead, to avoid scanning the entire string?
Regards,
--
Fujii Masao
view thread (15+ messages) latest in thread
reply
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: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Truncate logs by max_log_size
In-Reply-To: <CAHGQGwFOV+7nOdfoO=kfVH=-fRA9aQE1YcHHLYty3nfQ9rQ4RA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox