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

Daniel Gustafsson <daniel@yesql.se>

From: Daniel Gustafsson <daniel@yesql.se>
To: Greg Sabino Mullane <htamfids@gmail.com>
Cc: 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-14T08:55:39Z
Lists: pgsql-hackers
> On 13 Mar 2025, at 15:03, Greg Sabino Mullane <htamfids@gmail.com> wrote:
> 
> Patch looks good. One minor issue:
> 
> greg=# \set WATCH_INTERVAL -1
> invalid value "-1" for "WATCH_INTERVAL": must be greater than 0.00
> greg=# \set WATCH_INTERVAL 0.00
> greg=#
> 
> We should disallow 0 as the error message implies

Ah, nice catch, fixed in the attached along with a test for the minimum bound (ie zero).

>> I've long wanted to be able to set the default interval for \watch in psql since I almost never want a 2 second wait. 
> 
> Curious what other's personal defaults are? I usually use 1 second or 0.5 depending on things.

I rarely use anything higher than 0.5.

--
Daniel Gustafsson



Commits

  1. psql: Fix incorrect equality comparison

  2. psql: Make test robust against locale variations

  3. psql: Make default \watch interval configurable