Re: psql \watch 2nd argument: iteration count

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Andrey Borodin <amborodin86(at)gmail(dot)com>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, sfrost(at)snowman(dot)net, peter(dot)eisentraut(at)enterprisedb(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql \watch 2nd argument: iteration count
Date: 2023-03-08 18:49:44
Message-ID: 20230308184944.GA3552001@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2023-03-08 18:58:09 Re: optimize several list functions with SIMD intrinsics
Previous Message Tom Lane 2023-03-08 18:49:09 Re: proposal - get_extension_version function