Re: Q: limit the length of log file entries?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Albrecht Dreß <albrecht(dot)dress(at)posteo(dot)de>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Q: limit the length of log file entries?
Date: 2025-09-03 19:07:08
Message-ID: 832141.1756926428@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

Albrecht =?iso-8859-1?b?RHJl3w==?= <albrecht(dot)dress(at)posteo(dot)de> writes:
> I have a PL/PGsql DB function 'addval(_id text, _data bytea) RETURNS VOID'. When a broken bytea is passed as 2nd parameter, something like

> albrecht(at)test FEHLER: ungültige hexadezimale Ziffer: »r« bei Zeichen 28
> albrecht(at)test ANWEISUNG: SELECT FROM addval('hopp', '\xbroken')

> is printed in the log file. This is fine and very helpful in this case, but I have a “friendly user” who transmitted a broken hex string of ~100 KBytes as second parameter, resulting in a log line of this size which is not really readable and when done frequently quickly fills the logs.

There isn't any provision for limiting the length of source queries
quoted in the log. Had your user sent the bytea value as a query
parameter, then log_parameter_max_length[_on_error] would have
applied, but this looks like the value was just inline in the query.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Álvaro Herrera 2025-09-04 12:02:15 Re: In-order pg_dump (or in-order COPY TO)
Previous Message Adrian Klaver 2025-09-03 15:56:22 Re: Q: limit the length of log file entries?