BUG #19581: Non-UTF8-encoded text in log file

Started by PG Bug reporting form29 days ago2 messagesbugs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following bug has been logged on the website:

Bug reference: 19581
Logged by: Redoute
Email address: redoute@tortenboxer.de
PostgreSQL version: 17.4
Operating system: Windows 11
Description:

Internal log messages (e.g. checkpoint messages) are written with CP1252
bytes (0xFC for ü) instead of UTF-8. Consequently
pg_read_file(pg_current_logfile()) fails with invalid byte sequence for
encoding "UTF8": 0xfc. SQL error messages in the same log appear correctly
encoded.

Wrongly encoded log file entry:

2026-07-26 08:26:19 CEST LOG: Checkpoint komplett: 7 Puffer geschrieben
(0.0%); 0 WAL-Datei(en) hinzugefügt, 0 entfernt, 0 wiederverwendet;
Schreiben=0,776 s, Sync=0,047 s, gesamt=0,864 s; sync. Dateien=6,
l䮧ste=0,019 s, Durchschnitt=0.008 s; Entfernung=3 kB, Sch䴺ung=213 kB;
LSN=2E4/8A2C65C0, Redo-LSN=2E4/8A2C6568

Correctly encoded log file entries in the same file:

2026-07-26 11:36:16 CEST FEHLER: ungültige Byte-Sequenz für Kodierung
»UTF8«: 0xfc
2026-07-26 11:36:16 CEST ANWEISUNG: /*pga4dash*/
SELECT pg_read_file(pg_current_logfile(), 0, 14787);

2026-07-26 11:37:54 CEST FEHLER: kann Tabelle netex.authority nicht
löschen, weil andere Objekte davon abhängen
2026-07-26 11:37:54 CEST DETAIL: Sicht netex.operators hängt von Tabelle
netex.authority ab
Sicht netex.linestat hängt von Tabelle netex.authority ab
2026-07-26 11:37:54 CEST TIPP: Verwenden Sie DROP ... CASCADE, um die
abhängigen Objekte ebenfalls zu löschen.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: PG Bug reporting form (#1)
Re: BUG #19581: Non-UTF8-encoded text in log file

PG Bug reporting form <noreply@postgresql.org> writes:

Internal log messages (e.g. checkpoint messages) are written with CP1252
bytes (0xFC for ü) instead of UTF-8.

I see no reason to think this is a bug. It's documented that sessions
write to the log in whatever their prevailing encoding is. I think
the checkpointer isn't attached to any particular database, so instead
of adopting some database's encoding it would use whatever is implied
by the postmaster's locale environment (LANG, LC_ALL, LC_CTYPE, or
related environment variables). So would the postmaster itself, for
that matter.

regards, tom lane