\watch 0 or \watch 0.00001 doesn't do what I want - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject \watch 0 or \watch 0.00001 doesn't do what I want
Date
Msg-id 88445e0e-3156-4b9d-afae-9a1a7b1631f6@iki.fi
Whole thread Raw
Responses Re: \watch 0 or \watch 0.00001 doesn't do what I want
Re: \watch 0 or \watch 0.00001 doesn't do what I want
List pgsql-hackers
Daniel's post [1] on \watch reminded me of this little issue I bumped into:

I wanted to run a query in a tight loop, without any delay. I tried 
"\watch 0", but it didn't do what I wanted:

postgres=# \watch 0
Wed 09 Oct 2024 16:34:19 EEST (every 1s)

  ?column?
----------
         1
(1 row)

Wed 09 Oct 2024 16:34:20 EEST (every 1s)

  ?column?
----------
         1
(1 row)

^C

Then I tried setting the delay really small, but that didn't do what I 
wanted either:

postgres=# \watch 0.00001
Wed 09 Oct 2024 16:36:45 EEST (every 1e-05s)

  ?column?
----------
         1
(1 row)

^C

It runs the query just once and then hangs forever, until I hit CTRL-C 
to cancel.

[1] 
https://www.postgresql.org/message-id/B2FD26B4-8F64-4552-A603-5CC3DF1C7103%40yesql.se

-- 
Heikki Linnakangas
Neon (https://neon.tech)



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: [PATCH] Add some documentation on how to call internal functions
Next
From: Heikki Linnakangas
Date:
Subject: Re: \watch 0 or \watch 0.00001 doesn't do what I want