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-15 02:48:17
Message-ID: CAGRkXqR63wr4v2A+KuX3-6pruB9GW8ujkkNhvjhcVWK40Xo5ZQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Fujii,

> We should address this case as well, or is it reasonable to ignore it as
> an edge case?

I can reproduce it, and I think we should fix it. Guessing the encoding
gettext uses keeps missing cases.

v6 does two things. It treats OUTPUT_CHARSET as set if it was set when
psql started, since gettext keeps using that value.

I fuzzed it with random locales, encodings, \setenv, \encoding and \c,
12000 cases on Linux and macOS. v6 had no errors. Unpatched 19 failed in
about 4% of them.

Thanks,
Shihao

Attachment Content-Type Size
v6-0001-psql-Fall-back-to-English-for-unsafe-hidden-query-REL_19_STABLE.patch.txt text/plain 36.6 KB
v6-0001-psql-Fall-back-to-English-for-unsafe-hidden-query.patch application/octet-stream 36.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tender Wang 2026-10-15 03:13:07 Re: Wrong results from self-join elimination with different restriction operators
Previous Message surya poondla 2026-10-15 02:40:33 Re: REPACK: warn about skipping foreign partitions