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

From: Kirill Reshke <reshkekirill(at)gmail(dot)com>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Allow default \watch interval in psql to be configured
Date: 2024-11-04 13:55:48
Message-ID: CALdSSPjuFJJOmdr+vxvhwqv_HRm+d-OMh-Bm2-XTdmvmBfWjrg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 9 Oct 2024 at 19:24, Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:
>
> > On 9 Oct 2024, at 16:05, Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:
>
> Thanks for looking!
>
> > I guess the '1000' was supposed to be the maximum, but ParseVariableDouble doesn't take a maximum.
>
> Doh, I had a max parameter during hacking but removed it since I didn't see a
> clear usecase for it. Since it's not an externally published API we can
> alwasys add it when there is need. Clearly I managed to generate the patch at
> the wrong time without noticing. Fixed.
>
> > That's a little inaccurate: 0 is also accepted, so should be "must be greater than *or equal to* 0". Or maybe "cannot be negative". -0 is also accepted, though.
>
> I changed to "must be at least XX" to keep the message short.
>
> > set -> sets
> >
> > beetween -> between
>
> Fixed.
>
> --
> Daniel Gustafsson
>

Hi!
I'm mostly fine with this patch, but maybe we need to handle `errno ==
ERANGE` inside ParseVariableDouble and provide a better error msg in
this case?
Something like:
```
reshke=# \set WATCH_INTERVAL -1e-309
underflow while parsing parameter
```
Also, maybe we should provide `double max` arg to the
ParseVariableDouble function, because this is a general-use function?

--
Best regards,
Kirill Reshke

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2024-11-04 14:02:08 Re: pgsql: Implement pg_wal_replay_wait() stored procedure
Previous Message Kirill Reshke 2024-11-04 13:38:28 Re: Useless field ispartitioned in CreateStmtContext