Re: psql \watch 2nd argument: iteration count
Nathan Bossart <nathandbossart@gmail.com>
From: Nathan Bossart <nathandbossart@gmail.com>
To: Andrey Borodin <amborodin86@gmail.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>, sfrost@snowman.net, peter.eisentraut@enterprisedb.com, pgsql-hackers@postgresql.org
Date: 2023-03-08T18:49:44Z
Lists: pgsql-hackers
+1 for adding an iteration count argument to \watch.
+ char *opt_end;
+ sleep = strtod(opt, &opt_end);
+ if (sleep <= 0 || *opt_end)
+ {
+ pg_log_error("Watch period must be positive number, but argument is '%s'", opt);
+ free(opt);
+ resetPQExpBuffer(query_buf);
+ return PSQL_CMD_ERROR;
+ }
Is there any reason to disallow 0 for the sleep argument? I often use
commands like "\watch .1" to run statements repeatedly with very little
time in between, and I'd use "\watch 0" instead if it was available.
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
Commits
-
psql: add an optional execution-count limit to \watch.
- 00beecfe839c 16.0 landed
-
Improve handling of psql \watch's interval argument
- 6f9ee74d45aa 16.0 landed