Re: Allow default \watch interval in psql to be configured

Pavel Stehule <pavel.stehule@gmail.com>

From: Pavel Stehule <pavel.stehule@gmail.com>
To: Daniel Gustafsson <daniel@yesql.se>
Cc: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, Greg Sabino Mullane <htamfids@gmail.com>, Masahiro Ikeda <ikedamsh@oss.nttdata.com>, Kirill Reshke <reshkekirill@gmail.com>, Heikki Linnakangas <hlinnaka@iki.fi>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-03-26T09:12:32Z
Lists: pgsql-hackers
st 26. 3. 2025 v 9:05 odesílatel Daniel Gustafsson <daniel@yesql.se> napsal:

> > On 26 Mar 2025, at 08:42, Pavel Stehule <pavel.stehule@gmail.com> wrote:
>
> > The reason is probably my LANG=cs_CZ.UTF8. When I switched to LANG=C,
> then tests passed.
> >
> > The main problem is in numeric format. Czech uses the comma instead of
> the dot.
>
> Thanks for investigating!  The main value of the test is to test setting
> value
> and unsetting it again, so we could just as well use an integer value like
> the
> diff below.  Does it pass for you with that instead?
>
> diff --git a/src/bin/psql/t/001_basic.pl b/src/bin/psql/t/001_basic.pl
> index 7192d96049d..739cb439708 100644
> --- a/src/bin/psql/t/001_basic.pl
> +++ b/src/bin/psql/t/001_basic.pl
> @@ -436,12 +436,12 @@ psql_fails_like(
>  psql_like(
>         $node,
>         '\echo :WATCH_INTERVAL
> -\set WATCH_INTERVAL 0.001
> +\set WATCH_INTERVAL 10
>  \echo :WATCH_INTERVAL
>  \unset WATCH_INTERVAL
>  \echo :WATCH_INTERVAL',
>         qr/^2$
> -^0.001$
> +^10$
>  ^2$/m,
>         'WATCH_INTERVAL variable is set and updated');
>  psql_fails_like(
>
> --
> Daniel Gustafsson
>

yes, it is ok after this change

Pavel

Commits

  1. psql: Fix incorrect equality comparison

  2. psql: Make test robust against locale variations

  3. psql: Make default \watch interval configurable