Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vVHiJ-00HZ87-2h for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Dec 2025 23:10:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vVHiI-0034Lp-2U for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Dec 2025 23:10:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vVHiI-0034Lh-1Z for pgsql-hackers@lists.postgresql.org; Mon, 15 Dec 2025 23:10:47 +0000 Received: from mail-yw1-x1134.google.com ([2607:f8b0:4864:20::1134]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vVHiG-000whD-1t for pgsql-hackers@lists.postgresql.org; Mon, 15 Dec 2025 23:10:46 +0000 Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-78c33d0df85so56062637b3.0 for ; Mon, 15 Dec 2025 15:10:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765840243; x=1766445043; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=eSSDG/0XJdIN7sM+epQp/xXSNCGlKPkfrjdqhVP6AWo=; b=PKIlBsvEEeAY1KqTkSd6GR/OwNnk+zLMLCDiORdklOA2TjkhmCoozNLgPQIrwRVTzC 8MmmMU57qzjjh7rd5V2DZkHL+l2zDG4Yt3OShSoySImhgj1SH9uniZgGDhKFxmUJveS3 Nkbxkc2cAYb3oi4q2S3oV44RmVJeeNiM9dcIy8fsuEcXR6CXx9A4/ypn1bx1P5HysfGZ JVvwj05M1DS0lyjRXhxJ09ePFCbg9aPBQMFLhvj5NGlcYWQ2qizkKwj6bXT6nmjAHwT1 zVDLK7ANu4m1gn52r8gw4ywVNvp9s6RbGH6wqkIuNlLT4GMGdN4qpBrC7V5C0CmxQMyG uXSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765840243; x=1766445043; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=eSSDG/0XJdIN7sM+epQp/xXSNCGlKPkfrjdqhVP6AWo=; b=igFUMAiWiamLTNcHBHnpMkR5rMgy8W7M+cssm5oObvJn6nYhk8Pbn0wc1/23ewReYq Vr/q+EI3ZHlvhmDmocIBDC1gM9vXW2FKlNIrK5Ow7RffGn6Zl0qnd8asqnaNanjXnEY/ D77AcnAWncX+W8hYFMWmtm1rayyCwTc1WT66GeoItGJzZwCH/7u3MNnv0i91oBnALRs7 v/A2k8tmk2mYzagf1al1EIbR/xGO1vyOGReMbQ94EJNCHahh/5aE5HpXFRwnexIGlVyX 5ZZDcgzrDo/whnHYuv6kwkVuA/xsK0gPFPFOIGE4os1WdXGbgSO8gJpj/fDbKDB1qpE4 QV4Q== X-Gm-Message-State: AOJu0YzzTq8h2bYBwqDMEe4/1lw5MbRE3Dw+BMlcFyTSv19Fr9xW0iuk vi3vCT51zTD57o3RKkCVbxmDG8CnTZRJFIHrolrrXXCFi744oUTeuuJ/ X-Gm-Gg: AY/fxX6WIUY2QpcN6Byu1KYnIH6cix7/UmGvA73Jk3flwHtOaLyEV0o0xjHVwtgWN9+ IAxpd519UNLOQzPnXIG+VEtJ8g8MmPcu3iQNwihvNLB/wmJy0R1rBSCO/hGAPaaAItSLmJ/X583 9lw9E3cWXgSuJCADWJ2y46RX3E98j3nsXDTpRZU/VfvtvCeRdLmie9Oq4iPLJrF1leA1eFE+6xm pW7kzXMBfoXkbz3ZVseZ64oYRtK7J1QUz3m0C8kTsWdtUnl2uSQOH/+yhBgOM92ayllq6Jsz8po gR0luCvyZEJnXFRR+ZNKL+zaTA5eY0cZCIR1kiaPtOujQZBfS7gDICbqVgA8c256fJXsN4aWnDw /PDkjPiDhhb1oWnzSGKsNMNQ6Y5cHT2IafR+wZEYqDPRHMJXvKEor1eDERWYraYFbMPG1OqXQvm +YVniqn/Fot5UXoDq/yTARg7YaNnvU3YuNVHg8g7xhs/enGQr5MkUetDjRvsTWYuE3 X-Google-Smtp-Source: AGHT+IFPTPm9VIBTlbqRnoRfShcK6PObmZyCbFvgFIBHkQok+cZwW2xgkM+/lhUKOsZ78e8wxPzKdw== X-Received: by 2002:a05:690c:6608:b0:788:19b3:3fa1 with SMTP id 00721157ae682-78e66da5319mr110937547b3.25.1765840243046; Mon, 15 Dec 2025 15:10:43 -0800 (PST) Received: from ?IPV6:2600:1700:8952:80:404b:45ac:d270:bb24? ([2600:1700:8952:80:404b:45ac:d270:bb24]) by smtp.gmail.com with ESMTPSA id 00721157ae682-78e748cecd9sm33205327b3.9.2025.12.15.15.10.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Dec 2025 15:10:42 -0800 (PST) Message-ID: Date: Mon, 15 Dec 2025 17:10:36 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: PRI?64 vs Visual Studio (2022) To: Tom Lane Cc: pgsql-hackers@lists.postgresql.org References: <20250331.152829.1921392690375275165.horikyota.ntt@gmail.com> <001bdc3b-ef94-4f24-b017-ac8ff0a2ea55@eisentraut.org> <1372793.1763519315@sss.pgh.pa.us> <1377512.1763522154@sss.pgh.pa.us> <1462038.1763567038@sss.pgh.pa.us> <1881391.1765782112@sss.pgh.pa.us> <1991599.1765818338@sss.pgh.pa.us> <2117910.1765823286@sss.pgh.pa.us> <2128694.1765826341@sss.pgh.pa.us> <2259481.1765831157@sss.pgh.pa.us> Content-Language: en-US From: Bryan Green In-Reply-To: <2259481.1765831157@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 12/15/2025 2:39 PM, Tom Lane wrote: > I wrote: >> Experimenting here, it looks like 'C.UTF-8' might be accepted >> everywhere. I even got it to pass on Solaris's not-GNU gettext, >> which I thought for sure would be the weak spot in the idea. >> I'll press forward with that. > > Hmmm ... the first batch of BF reports show that on some Linux > machines, it works to set lc_messages to 'C.UTF-8', but nonetheless > no translation happens. Did you notice any other gating factors? > > regards, tom lane Yes - the LANGUAGE environment variable. gettext has a priority order for locale selection that's different from what most people expect. Here's what guess_category_value() does: Environment Variable Priority (from dcigettext.c): 1. LANGUAGE - GNU extension, colon-separated list (e.g., "en_US:en:C") 2. setlocale(category, NULL) result - the actual locale set 3. LC_ALL - POSIX override for all categories 4. LC_MESSAGES (or other LC_* for that category) 5. LANG - fallback default LANGUAGE has the highest priority and will override LC_MESSAGES completely. I am not sure this is the problem, but you probably should unset LANGUAGE before doing almost anything else in the test script. I wouldn't be surprised if the CI/BF environments have it set. Do we know what version of libintl is being used on those BF machines? There are some marked differences between some versions, which makes this a little more guesswork than it should be. --------------------------------------------------------------------- What follows is a walkthrough that just shows that language overrides lc_messages and how that can impact things. No need to read this unless you just want more detail. Assume, export LANGUAGE=en_US:en export LC_MESSAGES=C.UTF-8 System has catalogs for C.UTF-8 and es. #postgres.conf lc_messages = 'C.UTF-8' InitPostgres calls pg_perm_setlocale with C.UTF-8. pg_perm_setlocale calls setlocale(LC_MESSAGES, "C.UTF-8") and succeeds. setlocale uses setenv to set LC_MESSAGES=C.UTF_8 Now assume an error occurs and gettext is called. A couple of wrappers down we get to DCIGETTEXT() with a category of LC_MESSAGES. We call guess_category_value with LC_MESSAGES. guess_category_value implements the priorty as discussed above. The very first thing it checks is getenv("LANGUAGE"). If that is not NULL or an empty string it returns whatever is in LANGUAUGE, which in this case is en_US:en. Then back in DCIGETTEXT() we will loop through en_US:en. We try to find the message catalog with 'en_US' first...and fail because we don't have that catalog. Then we loop back and try 'en'...and fail again because we don't have that catalog. One more time through the loop where we don't have anything left in our list of languages, so we set the locale to 'C'. Then we check that we don't translate if the locale is a single C. and we break. Nothing translated. -- Bryan Green EDB: https://www.enterprisedb.com