Re: [PG19] psql backslash commands fail with translated messages and a non UTF-8 client encoding

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Greg Sabino Mullane <htamfids(at)gmail(dot)com>
Subject: Re: [PG19] psql backslash commands fail with translated messages and a non UTF-8 client encoding
Date: 2026-10-16 04:31:43
Message-ID: CAGRkXqR6w499OnaWhkKWbEFi4CLuwU5tgpN564raO9u-n3UAhw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Thinking about that some more: why don't we just drop that test,
> along with the OUTPUT_CHARSET hacks, and confine ourselves to
> testing that (1) server_encoding equals client_encoding and
> (2) the translated string passes pg_encoding_verifymbstr?

Thanks for pushing the infrastructure. v8 does what you suggest,
with one more restriction: it translates only when both encodings are
UTF8.

WIN1252 accepts byte 0x81 but has no character for it. With
LANG=ja_JP.UTF-8, psql -f against a WIN1252 database sends the
Japanese label. It runs fine, but then a UTF8 client in that database
can't read pg_stat_activity:

ERROR: character with byte sequence 0x81 in encoding "WIN1252" has no
equivalent in encoding "UTF8"

Unpatched 19 does the same.

Thanks,
Shihao

Attachment Content-Type Size
v8-0001-psql-Fall-back-to-English-for-unsafe-hidden-query.patch application/octet-stream 2.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ma Xueting 2026-10-16 04:44:36 Re: [PATCH] Report no unpinned buffers as insufficient resources
Previous Message Michael Paquier 2026-10-16 04:09:15 Re: doc: fix pg_get_multixact_stats() num_mxids type (integer -> bigint)