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

Started by Tom Lanealmost 3 years ago16 messages
#1Tom Lane
tgl@sss.pgh.pa.us

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

\watch can now be told to stop after N executions of the query.

With the idea that we might want to add more options to \watch
in future, this patch generalizes the command's syntax to a list
of name=value options, with the interval allowed to omit the name
for backwards compatibility.

Andrey Borodin, reviewed by Kyotaro Horiguchi, Nathan Bossart,
Michael Paquier, Yugo Nagata, and myself

Discussion: /messages/by-id/CAAhFRxiZ2-n_L1ErMm9AZjgmUK=qS6VHb+0SaMn8sqqbhF7How@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/00beecfe839c878abb366b68272426ed5296bc2b

Modified Files
--------------
doc/src/sgml/ref/psql-ref.sgml | 10 +++-
src/bin/psql/command.c | 118 +++++++++++++++++++++++++++++++------
src/bin/psql/help.c | 2 +-
src/bin/psql/t/001_basic.pl | 33 ++++++++---
src/test/regress/expected/psql.out | 2 +-
src/test/regress/sql/psql.sql | 2 +-
6 files changed, 135 insertions(+), 32 deletions(-)

#2Alexander Korotkov
aekorotkov@gmail.com
In reply to: Tom Lane (#1)
1 attachment(s)
Re: pgsql: psql: add an optional execution-count limit to \watch.

Hi!

On Thu, Apr 6, 2023 at 8:18 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:

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

\watch can now be told to stop after N executions of the query.

This commit makes tests fail for me. psql parses 'i' option of
'\watch' using locale-aware strtod(), but 001_basic.pl uses hard-coded
decimal separator. The proposed fix is attached.

------
Regards,
Alexander Korotkov

Attachments:

psql_test_fix.patchapplication/octet-stream; name=psql_test_fix.patchDownload
diff --git a/src/bin/psql/t/001_basic.pl b/src/bin/psql/t/001_basic.pl
index 56b1e3e4a6f..52b982a5f80 100644
--- a/src/bin/psql/t/001_basic.pl
+++ b/src/bin/psql/t/001_basic.pl
@@ -3,6 +3,7 @@
 
 use strict;
 use warnings;
+use locale;
 
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
@@ -353,7 +354,7 @@ psql_like(
 # Check \watch
 psql_like(
 	$node,
-	'SELECT 1 \watch c=3 i=0.01',
+	sprintf('SELECT 1 \watch c=3 i=%g', 0.01),
 	qr/1\n1\n1/,
 	'\watch with 3 iterations');
 
#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alexander Korotkov (#2)
Re: pgsql: psql: add an optional execution-count limit to \watch.

Alexander Korotkov <aekorotkov@gmail.com> writes:

On Thu, Apr 6, 2023 at 8:18 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:

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

This commit makes tests fail for me. psql parses 'i' option of
'\watch' using locale-aware strtod(), but 001_basic.pl uses hard-coded
decimal separator.

Huh, yeah, I see it too if I set LANG=ru_RU.utf8 before running psql's
TAP tests. It seems unfortunate that none of the buildfarm has noticed
this. I guess all the TAP tests are run under C locale?

The proposed fix is attached.

LGTM, will push in a bit (unless you want to?)

regards, tom lane

#4Alexander Korotkov
aekorotkov@gmail.com
In reply to: Tom Lane (#3)
Re: pgsql: psql: add an optional execution-count limit to \watch.

On Fri, Apr 7, 2023 at 5:00 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:

Alexander Korotkov <aekorotkov@gmail.com> writes:

On Thu, Apr 6, 2023 at 8:18 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:

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

This commit makes tests fail for me. psql parses 'i' option of
'\watch' using locale-aware strtod(), but 001_basic.pl uses hard-coded
decimal separator.

Huh, yeah, I see it too if I set LANG=ru_RU.utf8 before running psql's
TAP tests. It seems unfortunate that none of the buildfarm has noticed
this. I guess all the TAP tests are run under C locale?

I wonder if we can setup as least some buildfarm members to exercise
TAP tests on non-C locales.

The proposed fix is attached.

LGTM, will push in a bit (unless you want to?)

Please push.

------
Regards,
Alexander Korotkov

#5Aleksander Alekseev
aleksander@timescale.com
In reply to: Alexander Korotkov (#4)
1 attachment(s)
Re: pgsql: psql: add an optional execution-count limit to \watch.

Hi,

I wonder if we can setup as least some buildfarm members to exercise
TAP tests on non-C locales.

The proposed fix is attached.

LGTM, will push in a bit (unless you want to?)

Please push.

The test still fails under the following conditions:

```
$ env | grep UTF-8
LC_ADDRESS=ru_RU.UTF-8
LC_NAME=ru_RU.UTF-8
LC_MONETARY=ru_RU.UTF-8
LC_PAPER=ru_RU.UTF-8
LANG=en_US.UTF-8
LC_IDENTIFICATION=ru_RU.UTF-8
LC_TELEPHONE=ru_RU.UTF-8
LC_MEASUREMENT=ru_RU.UTF-8
LC_CTYPE=en_US.UTF-8
LC_TIME=ru_RU.UTF-8
LC_ALL=en_US.UTF-8
LC_NUMERIC=ru_RU.UTF-8
```

This is up-to-dated Ubuntu 22.04 with pretty much default settings
except for the timezone changed to MSK and enabled Russian keyboard
layout.

Here is a proposed fix. I realize this is a somewhat suboptimal
solution, but it makes the test pass regardless of the locale
settings.

--
Best regards,
Aleksander Alekseev

Attachments:

fix.diffapplication/octet-stream; name=fix.diffDownload
diff --git a/src/bin/psql/t/001_basic.pl b/src/bin/psql/t/001_basic.pl
index 596746de17..a74d24b63d 100644
--- a/src/bin/psql/t/001_basic.pl
+++ b/src/bin/psql/t/001_basic.pl
@@ -355,7 +355,7 @@ psql_like(
 # Note: the interval value is parsed with locale-aware strtod()
 psql_like(
 	$node,
-	sprintf('SELECT 1 \watch c=3 i=%g', 0.01),
+	sprintf('SELECT 1 \watch c=3 i=%g', 1),
 	qr/1\n1\n1/,
 	'\watch with 3 iterations');
 
#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Aleksander Alekseev (#5)
Re: pgsql: psql: add an optional execution-count limit to \watch.

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?

regards, tom lane

#7Aleksander Alekseev
aleksander@timescale.com
In reply to: Tom Lane (#6)
Re: pgsql: psql: add an optional execution-count limit to \watch.

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

#8Tom Lane
tgl@sss.pgh.pa.us
In reply to: Aleksander Alekseev (#7)
1 attachment(s)
Re: pgsql: psql: add an optional execution-count limit to \watch.

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

Attachments:

fix-TAP-test-locale-settings.patchtext/x-diff; charset=us-ascii; name=fix-TAP-test-locale-settings.patchDownload
diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm
index 878e12b15e..4c6cde8974 100644
--- a/src/test/perl/PostgreSQL/Test/Utils.pm
+++ b/src/test/perl/PostgreSQL/Test/Utils.pm
@@ -43,6 +43,7 @@ package PostgreSQL::Test::Utils;
 
 use strict;
 use warnings;
+use locale;
 
 use Carp;
 use Config;
@@ -55,6 +56,7 @@ use File::Spec;
 use File::stat qw(stat);
 use File::Temp ();
 use IPC::Run;
+use POSIX qw(locale_h);
 use PostgreSQL::Test::SimpleTee;
 
 # We need a version of Test::More recent enough to support subtests
@@ -102,6 +104,7 @@ BEGIN
 	delete $ENV{LANGUAGE};
 	delete $ENV{LC_ALL};
 	$ENV{LC_MESSAGES} = 'C';
+	setlocale(LC_ALL, "");
 
 	# This list should be kept in sync with pg_regress.c.
 	my @envkeys = qw (
#9Aleksander Alekseev
aleksander@timescale.com
In reply to: Tom Lane (#8)
Re: pgsql: psql: add an optional execution-count limit to \watch.

Hi,

The attached makes check-world pass for me under these conflicting
environment settings, but it's kind of a scary change. Thoughts?

FWIW my MacOS and Linux laptops have no complaints about the patch.

--
Best regards,
Aleksander Alekseev

#10Tom Lane
tgl@sss.pgh.pa.us
In reply to: Aleksander Alekseev (#9)
Re: pgsql: psql: add an optional execution-count limit to \watch.

Aleksander Alekseev <aleksander@timescale.com> writes:

The attached makes check-world pass for me under these conflicting
environment settings, but it's kind of a scary change. Thoughts?

FWIW my MacOS and Linux laptops have no complaints about the patch.

I realized that we don't actually need to "use locale" in Utils.pm
itself for this to work, which greatly assuages my fears of unexpected
side-effects. Pushed that way; I shall now retire to a safe distance
and watch the buildfarm.

regards, tom lane

#11Anton Voloshin
a.voloshin@postgrespro.ru
In reply to: Tom Lane (#10)
1 attachment(s)
Re: pgsql: psql: add an optional execution-count limit to \watch.

Hello, hackers.

On 18/04/2023 20:34, Tom Lane wrote (on pgsql-committers):

I shall now retire to a safe distance and watch the buildfarm.

Unfortunately, on fresh perl (5.38.2 verified) and on ru_RU.UTF-8
locale, it breaks basic float comparison: 0 < 0.5 is no longer true.

This is the reproduction on REL_16_STABLE (but it affects master
as well), using fresh Ubuntu 24.04 container.

0. I've used lxc to get a fresh container:
$ lxc launch ubuntu-daily:noble u2404
But I don't think lxc or containerization in general matters in this
case. Also, I think any environment with fresh enough Perl would work,
Ubuntu 24.04 is just an easy example.

(obviously, install necessary dev packages)

1. Generate ru_RU.UTF-8 locale:
a. In /etc/locale.gen, uncomment the line:
# ru_RU.UTF-8 UTF-8

b. Run locale-gen as root. For me, it says:
$ sudo locale-gen
Generating locales (this might take a while)...
en_US.UTF-8... done
ru_RU.UTF-8... done
Generation complete.

2. Apply 0001-demo-of-weird-Perl-setlocale-effect-on-float-numbers.patch
(adding src/test/authentication/t/999_broken.pl)

3. Run the test
LANG=ru_RU.UTF-8 make check -C src/test/authentication
PROVE_TESTS=t/999_broken.pl PROVE_FLAGS=--verbose

The test is, basically:
use PostgreSQL::Test::Utils;
use Test::More tests => 1;
ok(0 < 0.5, "0 < 0.5");

If I comment-out the "use PostgreSQL::Test::Utils" line, the test works.
Otherwise it fails to notice that 0 is less than 0.5.

Alternatively, the test fails if I replace that "use" line with
BEGIN {
use POSIX qw(locale_h);
setlocale(LC_NUMERIC, "");
}

"BEGIN" part is essential: mere use/setlocale is fine.

Also, adding
use locale;
or even
use locale ':numeric';
fixes the test, but I doubt whether it's a good idea to add that to
Utils.pm.

Obviously, one of the reasons is that according to ru_RU.UTF-8 locale
for LC_NUMERIC, fractional part separator is ",", not ".". So one could,
technically, parse "0.5" as "0" and then unparsed ".5" tail. I think it
might even be a Perl bug, because, according to my quick browsing of man
perlfunc (setlocale) and man perllocale, this should not affect the code
outside "use locale", not in such a fundamental way. After all, we're
talking not about strtod etc, but about floating-point numbers in the
source code.

P.S. $ perl --version

This is perl 5, version 38, subversion 2 (v5.38.2) built for
x86_64-linux-gnu-thread-multi
(with 44 registered patches, see perl -V for more detail)

P.P.S. I'm replying to pgsql-hackers, even though part of previous
discussion have been on pgsql-committers. Hopefully, it's OK.

--
Anton Voloshin
Postgres Professional, The Russian Postgres Company
https://postgrespro.ru

Attachments:

0001-demo-of-weird-Perl-setlocale-effect-on-float-numbers.patchtext/x-patch; charset=UTF-8; name=0001-demo-of-weird-Perl-setlocale-effect-on-float-numbers.patchDownload
From 6d1719de49b1c690e1fb7aeed8fc760f053a2a31 Mon Sep 17 00:00:00 2001
From: Anton Voloshin <a.voloshin@postgrespro.ru>
Date: Thu, 25 Apr 2024 17:23:26 +0000
Subject: [PATCH] demo of weird Perl setlocale effect on float numbers
 comparison

---
 src/test/authentication/t/999_broken.pl | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 src/test/authentication/t/999_broken.pl

diff --git a/src/test/authentication/t/999_broken.pl b/src/test/authentication/t/999_broken.pl
new file mode 100644
index 00000000000..e65a272e1cb
--- /dev/null
+++ b/src/test/authentication/t/999_broken.pl
@@ -0,0 +1,8 @@
+use strict;
+use warnings FATAL => 'all';
+
+use PostgreSQL::Test::Utils;
+
+use Test::More tests => 1;
+
+ok(0 < 0.5, "0 < 0.5");
-- 
2.43.0

#12Tom Lane
tgl@sss.pgh.pa.us
In reply to: Anton Voloshin (#11)
Re: pgsql: psql: add an optional execution-count limit to \watch.

Anton Voloshin <a.voloshin@postgrespro.ru> writes:

On 18/04/2023 20:34, Tom Lane wrote (on pgsql-committers):

I shall now retire to a safe distance and watch the buildfarm.

Unfortunately, on fresh perl (5.38.2 verified) and on ru_RU.UTF-8
locale, it breaks basic float comparison: 0 < 0.5 is no longer true.

Haven't we worked around that everywhere it matters, in commits such
as 8421f6bce and 605062227? For me, check-world passes under
LANG=ru_RU, even with perl 5.38.2 (where I do confirm that your
test script fails). The buildfarm isn't unhappy either.

Obviously, one of the reasons is that according to ru_RU.UTF-8 locale
for LC_NUMERIC, fractional part separator is ",", not ".". So one could,
technically, parse "0.5" as "0" and then unparsed ".5" tail. I think it
might even be a Perl bug, because, according to my quick browsing of man
perlfunc (setlocale) and man perllocale, this should not affect the code
outside "use locale", not in such a fundamental way. After all, we're
talking not about strtod etc, but about floating-point numbers in the
source code.

I agree that it's a Perl bug, mainly because your test case doesn't
fail in Perls as recent as v5.32.1 (released about 3 years ago).
It's impossible to believe that they intentionally broke basic
Perl constant syntax now, after so many years. Particularly in
this way --- what are we supposed to do, write "if (0 < 0,5)"?
That means something else.

regards, tom lane

#13Anton Voloshin
a.voloshin@postgrespro.ru
In reply to: Tom Lane (#12)
2 attachment(s)
Re: pgsql: psql: add an optional execution-count limit to \watch.

On 26/04/2024 05:20, Tom Lane wrote:

Haven't we worked around that everywhere it matters, in commits such
as 8421f6bce and 605062227?

Yes, needing 8421f6bce and 605062227 was, perhaps, surprising, but
reasonable. Unlike breaking floating point constants in the source code.
But, I guess, you're right and, since it does look like a Perl bug,
we'll have to work around that in all places where we use floating-point
constants in Perl code, which are surprisingly few.

For me, check-world passes under
LANG=ru_RU, even with perl 5.38.2 (where I do confirm that your
test script fails). The buildfarm isn't unhappy either.

Indeed, check-world seems to run fine on my machine and on the bf as well.

Grepping and browsing through, I've only found three spots with \d\.\d
directly in Perl code as a float, only one of them needs correction.

1. src/test/perl/PostgreSQL/Test/Kerberos.pm in master
src/test/kerberos/t/001_auth.pl in REL_16_STABLE

if ($krb5_version >= 1.15)

I guess adding use locale ':numeric' would be easiest workaround here.
Alternatively, we could also split version into krb5_major_version and
krb5_minor_version while parsing krb5-config --version's output above,
but I don't think that's warranted. So I suggest something along the
lines of 0001-use-numeric-locale-in-kerberos-test-rel16.patch and
*-master.patch (attached, REL_16 and master need this change in
different places).

I did verify by providing fake 'krb5-config' that before the fix, with
LANG=ru_RU.UTF-8 and Perl 5.38.2 and with, say, krb5 "version" 1.13 it
would still add the "listen" lines to kdc.conf by mistake (presumably,
confusing some versions of kerberos).

2 and 3. contrib/intarray/bench/create_test.pl

if (rand() < 0.7)

and

if ($#sect < 0 || rand() < 0.1)

PostgreSQL::Test::Utils is not used there, so it's OK, no change needed.

I did not find any other float constants in .pl/.pm files in master (I
could have missed something).

Particularly in
this way --- what are we supposed to do, write "if (0 < 0,5)"?
That means something else.

Yep. I will try to report this to Perl community later.

--
Anton Voloshin
Postgres Professional, The Russian Postgres Company
https://postgrespro.ru

Attachments:

0001-use-numeric-locale-in-kerberos-test-rel16.patchtext/x-patch; charset=UTF-8; name=0001-use-numeric-locale-in-kerberos-test-rel16.patchDownload
From bc187cd95f91d5a7fe97ba4ccfaf75b77e2f03c8 Mon Sep 17 00:00:00 2001
From: Anton Voloshin <a.voloshin@postgrespro.ru>
Date: Fri, 26 Apr 2024 12:24:49 +0000
Subject: [PATCH] use numeric locale in kerberos test to work around perl bug

After b124104e7 we became susceptible to Perl bug (at least on Perl
5.38.2), where on locales with non-dot fractional part separator,
floating-point constants in perl source are broken (1.15 would be '1').
Work around that by using numeric locale in this file.
---
 src/test/kerberos/t/001_auth.pl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/test/kerberos/t/001_auth.pl b/src/test/kerberos/t/001_auth.pl
index d74e4af464e..9475f14d50e 100644
--- a/src/test/kerberos/t/001_auth.pl
+++ b/src/test/kerberos/t/001_auth.pl
@@ -23,6 +23,8 @@ use PostgreSQL::Test::Utils;
 use PostgreSQL::Test::Cluster;
 use Test::More;
 use Time::HiRes qw(usleep);
+# Work around the Perl 5.38.2 bug: we need floating-point constants.
+use locale ':numeric';
 
 if ($ENV{with_gssapi} ne 'yes')
 {
-- 
2.43.0

0001-use-numeric-locale-in-kerberos-test-master.patchtext/x-patch; charset=UTF-8; name=0001-use-numeric-locale-in-kerberos-test-master.patchDownload
From d6ee9a5567cea503c211fa41a0f741c71aa60ad5 Mon Sep 17 00:00:00 2001
From: Anton Voloshin <a.voloshin@postgrespro.ru>
Date: Fri, 26 Apr 2024 14:23:28 +0000
Subject: [PATCH] use numeric locale in kerberos test to work around perl bug

After b124104e7 we became susceptible to Perl bug (at least on Perl
5.38.2), where on locales with non-dot fractional part separator,
floating-point constants in perl source are broken (1.15 would be '1').
Work around that by using numeric locale in this file.
---
 src/test/perl/PostgreSQL/Test/Kerberos.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/test/perl/PostgreSQL/Test/Kerberos.pm b/src/test/perl/PostgreSQL/Test/Kerberos.pm
index f7810da9c1d..2c29c67329e 100644
--- a/src/test/perl/PostgreSQL/Test/Kerberos.pm
+++ b/src/test/perl/PostgreSQL/Test/Kerberos.pm
@@ -9,6 +9,8 @@ package PostgreSQL::Test::Kerberos;
 use strict;
 use warnings FATAL => 'all';
 use PostgreSQL::Test::Utils;
+# Work around the Perl 5.38.2 bug: we need floating-point constants.
+use locale ':numeric';
 
 our ($krb5_bin_dir, $krb5_sbin_dir, $krb5_config, $kinit, $klist,
 	 $kdb5_util, $kadmin_local, $krb5kdc,
-- 
2.43.0

#14Anton Voloshin
a.voloshin@postgrespro.ru
In reply to: Anton Voloshin (#13)
Re: pgsql: psql: add an optional execution-count limit to \watch.

On 26/04/2024 17:38, Anton Voloshin wrote:

I will try to report this to Perl community later.

Reported under https://github.com/Perl/perl5/issues/22176

Perl 5.36.3 seems to be fine (latest stable release before 5.38.x).
5.38.0 and 5.38.2 are broken.

--
Anton Voloshin
Postgres Professional, The Russian Postgres Company
https://postgrespro.ru

#15Tom Lane
tgl@sss.pgh.pa.us
In reply to: Anton Voloshin (#14)
Re: pgsql: psql: add an optional execution-count limit to \watch.

Anton Voloshin <a.voloshin@postgrespro.ru> writes:

On 26/04/2024 17:38, Anton Voloshin wrote:

I will try to report this to Perl community later.

Reported under https://github.com/Perl/perl5/issues/22176

Thanks for doing that.

Perl 5.36.3 seems to be fine (latest stable release before 5.38.x).
5.38.0 and 5.38.2 are broken.

If the misbehavior is that new, I'm inclined to do nothing about it,
figuring that they'll fix it sooner not later. If we were seeing
failures in main-line check-world tests then maybe it'd be worth
band-aiding those, but AFAICS we're not.

regards, tom lane

#16Andrew Dunstan
andrew@dunslane.net
In reply to: Tom Lane (#3)
Re: pgsql: psql: add an optional execution-count limit to \watch.

On 2023-04-07 Fr 10:00, Tom Lane wrote:

Alexander Korotkov<aekorotkov@gmail.com> writes:

On Thu, Apr 6, 2023 at 8:18 PM Tom Lane<tgl@sss.pgh.pa.us> wrote:

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

This commit makes tests fail for me. psql parses 'i' option of
'\watch' using locale-aware strtod(), but 001_basic.pl uses hard-coded
decimal separator.

Huh, yeah, I see it too if I set LANG=ru_RU.utf8 before running psql's
TAP tests. It seems unfortunate that none of the buildfarm has noticed
this. I guess all the TAP tests are run under C locale?

[just noticed this, redirecting to -hackers]

When run under meson, yes unless the LANG/LC_* settings are explicitly
in the build_env. I'm fixing that so we will allow them to pass through.
When run with configure/make they run with whatever is in the calling
environment unless overridden in the build_env.

We do have support for running installchecks with multiple locales.This
is done by passing --locale=foo to initdb.

We could locale-enable the non-install checks (for meson builds, that's
the 'misc-check' step, for configure/make builds it's more or less
everything between the install stages and the (first) initdb step. We'd
have to do that via appropriate environment settings, I guess. Would it
be enough to set LANG, or do we need to set the LC_foo settings
individually? Not sure how we manage it on Windows. Maybe just not
enable it for the first go-round.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com