Re: Truncate logs by max_log_size

Maxym Kharchenko <maxymkharchenko@gmail.com>

From: Maxym Kharchenko <maxymkharchenko@gmail.com>
To: Fujii Masao <masao.fujii@gmail.com>
Cc: Jim Jones <jim.jones@uni-muenster.de>, Kirill Reshke <reshkekirill@gmail.com>, Álvaro Herrera <alvherre@kurilemu.de>, Fujii Masao <masao.fujii@oss.nttdata.com>, Kirill Gavrilov <diphantxm@gmail.com>, "Andrey M. Borodin" <x4mmm@yandex-team.ru>, Euler Taveira <euler@eulerto.com>, pgsql-hackers@lists.postgresql.org
Date: 2026-04-17T17:03:49Z
Lists: pgsql-hackers
Hello Fujii-san,

There seems to be an inconsistency in the current patch. When a statement
has errors (for example, when it hits a table that does not exist), the
full statement is still being logged.

Similar parameter: `log_parameter_max_length` has a companion
`log_parameter_max_length_on_error` to handle this case (commit:
0b34e7d307e6,
https://github.com/postgres/postgres/commit/0b34e7d307e6a142ee94800e6d5f3e73449eeffd
).

Should the same treatment be added for `log_statement_max_length`?

Have a nice day,
Maxym Kharchenko

On Fri, Apr 17, 2026 at 6:32 AM Fujii Masao <masao.fujii@gmail.com> wrote:

> On Fri, Apr 10, 2026 at 7:36 AM Jim Jones <jim.jones@uni-muenster.de>
> wrote:
> > > I see the patch has been moved to CommitFest PG20-1. Once development
> for v20
> > > starts, I'd like to commit it.
> >
> >
> > Terrific. Thanks!
>
> Thanks for updating the patch! LGTM. Let's wait for next CF for v20 to
> begin.
>
> Regards,
>
> --
> Fujii Masao
>
>
>
>
>

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix log_statement_max_length test with verbose logs

  2. Add log_statement_max_length GUC to limit logged statement text

  3. Improve user control over truncation of logged bind-parameter values.