Re: pgsql: psql: add an optional execution-count limit to \watch.

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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 14:30:00
Message-ID: CAJ7c6TOFPoHVSxaQXfbm38_QN1v4qaugZW0LBTB-Gkvk2UwBQw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Hi Tom,

> Aleksander Alekseev <aleksander(at)timescale(dot)com> writes:
> > The test still fails under the following conditions:
>
> > $ env | grep UTF-8
> > LANG=en_US.UTF-8
> > LC_ALL=en_US.UTF-8
> > LC_NUMERIC=ru_RU.UTF-8
>
> 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.

If I set LC_NUMERIC manually:

```
LC_NUMERIC=en_US.UTF-8 meson test -C build --suite postgresql:psql
```

... the test passes. I can confirm that Perl doesn't seem to be
honoring LC_NUMERIC:

```
$ LC_ALL=en_US.UTF-8 LC_NUMERIC=en_US.UTF-8 perl -e 'use locale;
printf("%g\n", 0.01)'
0.01
$ LC_ALL=en_US.UTF-8 LC_NUMERIC=ru_RU.UTF-8 perl -e 'use locale;
printf("%g\n", 0.01)'
0.01
$ LC_ALL=ru_RU.UTF-8 LC_NUMERIC=en_US.UTF-8 perl -e 'use locale;
printf("%g\n", 0.01)'
0,01
$ LC_ALL=ru_RU.UTF-8 LC_NUMERIC=ru_RU.UTF-8 perl -e 'use locale;
printf("%g\n", 0.01)'
0,01
```

The Perl version is 5.34.0.

It is consistent with `perdoc perllocale`:

```
The initial program is started up using the locale specified from the
environment, as currently, described in "ENVIRONMENT". [...]

ENVIRONMENT
[...]
"LC_ALL" "LC_ALL" is the "override-all" locale environment variable.
If set, it overrides all the rest of the locale environment
variables.
```

So it looks like what happens is LC_ALL overwrites LC_NUMERIC for perl
but not for psql.

--
Best regards,
Aleksander Alekseev

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2023-04-10 15:09:41 Re: pgsql: psql: add an optional execution-count limit to \watch.
Previous Message Tom Lane 2023-04-10 13:54:42 Re: pgsql: psql: add an optional execution-count limit to \watch.

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2023-04-10 14:31:54 Re: longfin missing gssapi_ext.h
Previous Message Daneel Yaitskov 2023-04-10 14:17:48 Re: min/max aggregation for jsonb