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

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Anton Voloshin <a.voloshin@postgrespro.ru>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>, Alexander Korotkov <aekorotkov@gmail.com>, Andrew Dunstan <andrew@dunslane.net>, Aleksander Alekseev <aleksander@timescale.com>
Date: 2024-04-26T02:20:47Z
Lists: pgsql-hackers
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



Commits

  1. Fix Utils.pm's locale-munging so that Perl itself is also affected.

  2. Fix locale-dependent test case.

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