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

From: Anton Voloshin <a(dot)voloshin(at)postgrespro(dot)ru>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Aleksander Alekseev <aleksander(at)timescale(dot)com>
Subject: Re: pgsql: psql: add an optional execution-count limit to \watch.
Date: 2024-04-26 14:38:53
Message-ID: 81b84b74-01ad-4782-9114-86ff842b1fd7@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

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

Attachment Content-Type Size
0001-use-numeric-locale-in-kerberos-test-rel16.patch text/x-patch 1.0 KB
0001-use-numeric-locale-in-kerberos-test-master.patch text/x-patch 1.1 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Anton Voloshin 2024-04-26 17:04:23 Re: pgsql: psql: add an optional execution-count limit to \watch.
Previous Message Robert Haas 2024-04-26 12:49:44 pgsql: Minor fixes to pg_combinebackup and its documentation.

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2024-04-26 14:41:47 Re: Why don't we support external input/output functions for the composite types
Previous Message Robert Haas 2024-04-26 14:34:30 Re: Why don't we support external input/output functions for the composite types