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

Поиск
Список
Период
Сортировка
От Aleksander Alekseev
Тема Re: pgsql: psql: add an optional execution-count limit to \watch.
Дата
Msg-id CAJ7c6TOFPoHVSxaQXfbm38_QN1v4qaugZW0LBTB-Gkvk2UwBQw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pgsql: psql: add an optional execution-count limit to \watch.  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: pgsql: psql: add an optional execution-count limit to \watch.  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-committers
Hi Tom,

> Aleksander Alekseev <aleksander@timescale.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



В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pgsql: psql: add an optional execution-count limit to \watch.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pgsql: psql: add an optional execution-count limit to \watch.