Re: Truncate logs by max_log_size
Fujii Masao <masao.fujii@gmail.com>
From: Fujii Masao <masao.fujii@gmail.com>
To: Maxym Kharchenko <maxymkharchenko@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-20T08:04:17Z
Lists: pgsql-hackers
On Sat, Apr 18, 2026 at 2:04 AM Maxym Kharchenko <maxymkharchenko@gmail.com> wrote: > > 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`? I think extending log_statement_max_length, or adding something like log_statement_max_length_on_error, would be a good idea to cover statements logged on error. However, I think the current patch is good as it stands, so I'd recommend pursuing that as a separate patch after the current one is committed. 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 →
-
Fix log_statement_max_length test with verbose logs
- 9bfbf5bf6190 master landed
-
Add log_statement_max_length GUC to limit logged statement text
- c8bd8387c27a master landed
-
Improve user control over truncation of logged bind-parameter values.
- 0b34e7d307e6 13.0 cited