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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: shihao zhong <zhong950419(at)gmail(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, 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-15 19:34:03
Message-ID: 2717100.1792092843@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> The other thing I'm not super pleased about is invoking
> pg_get_encoding_from_locale() each time through. That seems like a
> moderately expensive operation. I also wonder whether the result
> can change intra-run and whether gettext will track it if so.

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?

Doing that is sufficient to guarantee that the translated label
will not fail the server's encoding check, and it depends only
on behaviors that are under our control; no guessing about what
gettext will do is required. It might be that the results will
look like junk to a human inspecting the server log later, but
I doubt we could make strong promises about that anyway.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Manu 2026-10-15 19:49:08 Re: ZSTD TOAST compression, and an extensible compression method encoding
Previous Message Zsolt Parragi 2026-10-15 19:27:36 [PG19] pg_upgrade from <= 18 loses the newest multixid if its members end at offset wraparound