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-14 04:11:33
Message-ID: 1129918.1791951093@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

shihao zhong <zhong950419(at)gmail(dot)com> writes:
> Looks like we agree on the three-way rule, with the API Tom suggested.
> v3 attached, done the way Tom suggested.

It's late here, so these comments may be off-base, but:

* It occurred to me that we could avoid all the gettext_noop()
decorations by adding addQueryComment to GETTEXT_TRIGGERS.
This is a little bit magic perhaps, but we use that approach with
most functions that take a potentially-translated string.

* On Windows, this version of addQueryComment() performs a
gettext() lookup and then unconditionally discards the result.
Elsewhere it only conditionally discards the result, but neither
thing seems great. Should we invert the logic to avoid a useless
gettext lookup?

* Do we actually need to test for OUTPUT_CHARSET, given that
this code doesn't execute on Windows? My Linux man page for
gettext does not indicate that it responds to OUTPUT_CHARSET,
so I'm wondering if that is a Windows-only thing.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message ZizhuanLiu X-MAN 2026-10-14 04:24:32 Re: Optimize MCV stats for sortable types and utilize sorted-order properties
Previous Message shihao zhong 2026-10-14 04:07:15 Re: [PG19] Stale state after the join removal restart gives wrong results