From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Aleksander Alekseev <aleksander(at)timescale(dot)com> |
Cc: | pgsql-committers(at)lists(dot)postgresql(dot)org, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net> |
Subject: | Re: pgsql: psql: add an optional execution-count limit to \watch. |
Date: | 2023-04-10 15:09:41 |
Message-ID: | 4076950.1681139381@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
Aleksander Alekseev <aleksander(at)timescale(dot)com> writes:
>> Hmm, so psql is honoring the LC_NUMERIC setting in that environment,
>> but perl isn't. For me, it appears that adding 'use locale;' to
>> the test script will fix it ... can you confirm if it's OK for you?
> Right, src/bin/psql/t/001_basic.pl has "use locale;" since cd82e5c7
> and it fails nevertheless.
> ...
> So it looks like what happens is LC_ALL overwrites LC_NUMERIC for perl
> but not for psql.
Oh, right, there already is one :-(. After some more research,
I believe I see the problem: Utils.pm does
BEGIN
{
# Set to untranslated messages, to be able to compare program output
# with expected strings.
delete $ENV{LANGUAGE};
delete $ENV{LC_ALL};
$ENV{LC_MESSAGES} = 'C';
Normally, with your settings, LC_ALL=en_US.UTF-8 would dominate
everything. After removing that from the environment, the child
psql process will honor LC_NUMERIC=ru_RU.UTF-8 and expect \watch's
argument to be "0,01". However, I bet that perl has already made
its decisions about what its internal locale is, so it still thinks
it should print "0.01".
I am betting that we need to make Utils.pm do
setlocale(LC_ALL, "");
after the above-quoted bit, else it isn't doing what it is supposed to
if the calling script has already done "use locale;", as indeed
psql/t/001_basic.pl (and a small number of other places) do.
The attached makes check-world pass for me under these conflicting
environment settings, but it's kind of a scary change. Thoughts?
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
fix-TAP-test-locale-settings.patch | text/x-diff | 769 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2023-04-10 16:22:17 | pgsql: Doc: avoid using pg_get_publication_tables() in an example. |
Previous Message | Aleksander Alekseev | 2023-04-10 14:30:00 | Re: pgsql: psql: add an optional execution-count limit to \watch. |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2023-04-10 15:16:47 | Re: longfin missing gssapi_ext.h |
Previous Message | Stephen Frost | 2023-04-10 14:31:54 | Re: longfin missing gssapi_ext.h |