From 5ed9cee74c6cf23729bd5cc4dee3b0ebbd4aa7aa Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 17 Jul 2026 18:08:23 -0400 Subject: [PATCH] Fix yet another portability problem in new NLS test. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Álvaro reported offlist that his machine was passing the new-in-v19 nls.sql test in "make check" but not in "make installcheck". On investigation, the cause turned out to be that he has LANGUAGE set in his environment, and with (at least recent versions of) glibc that overrides LC_MESSAGES and friends, as per previous research by Bryan Green. "make check" works because pg_regress unsets LANGUAGE before starting the postmaster, but in installcheck mode we're exposed to the prevailing value and we lose. We're already hacking the value of LANGUAGE in this test for Solaris, so let's just extend that to unsetting LANGUAGE on every other platform. Reported-by: Álvaro Herrera Diagnosed-by: Andrew Dunstan Author: Tom Lane Discussion: https://postgr.es/m/a337896e-5bff-490b-afc9-c545f06c014c@gmail.com Backpatch-through: 19 --- src/test/regress/regress.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/regress/regress.c b/src/test/regress/regress.c index d5aafdf370c..90bb2a7e881 100644 --- a/src/test/regress/regress.c +++ b/src/test/regress/regress.c @@ -1335,9 +1335,15 @@ test_translation(PG_FUNCTION_ARGS) * Apparently the customary workaround is for users to set the * LANGUAGE environment variable to provide a mapping. Do so here to * ensure that the nls.sql regression test will work. + * + * With glibc and perhaps other implementations, LANGUAGE overrides + * LC_MESSAGES, which we don't want either; so let's unset it if we're + * not on Solaris. */ #if defined(__sun__) setenv("LANGUAGE", "es_ES.UTF-8:es", 1); +#else + unsetenv("LANGUAGE"); #endif pg_bindtextdomain(TEXTDOMAIN); inited = true; -- 2.47.3