Re: psql \watch 2nd argument: iteration count

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Andrey Borodin <amborodin86@gmail.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>, sfrost@snowman.net, peter.eisentraut@enterprisedb.com, pgsql-hackers@postgresql.org, Nikolay Samokhvalov <samokhvalov@gmail.com>
Date: 2023-03-14T00:26:03Z
Lists: pgsql-hackers

Attachments

On Sun, Mar 12, 2023 at 08:59:44PM -0700, Andrey Borodin wrote:
> I've tried this approach, but could not come up with sufficiently
> different error messages...
> 
>>  Wouldn't it be better to have a couple of regression
>> tests, as well?
> Added two tests.

It should have three tests with one for ERANGE on top of the other
two.  Passing down a value like "10e400" should be enough to cause
strtod() to fail, as far as I know.

+       if (sleep == 0)
+           continue;

While on it, forgot to comment on this one..  Indeed, this choice to
authorize 0 and not wait between two commands is more natural.

I have tweaked things as bit as of the attached, and ran pgindent.
What do you think?
--
Michael

Commits

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

  2. Improve handling of psql \watch's interval argument