Re: psql \watch 2nd argument: iteration count

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Andrey Borodin <amborodin86(at)gmail(dot)com>, 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, samokhvalov(at)gmail(dot)com
Subject: Re: psql \watch 2nd argument: iteration count
Date: 2023-03-16 00:54:43
Message-ID: ZBJo0xasYBqrL4Vy@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 15, 2023 at 04:58:49PM +0900, Michael Paquier wrote:
> Yep. You are right.

Fixed that and applied 0001.

+ valptr++;
+ if (strncmp("i", opt, strlen("i")) == 0 ||
+ strncmp("interval", opt, strlen("interval")) == 0)
+ {

Did you look at process_command_g_options() and if some consolidation
was possible? It would be nice to have APIs shaped so as more
sub-commands could rely on the same facility in the future.

- <term><literal>\watch [ <replaceable class="parameter">seconds</replaceable> ]</literal></term>
+ <term><literal>\watch [ <replaceable class="parameter">seconds</replaceable> [ <replaceable class="parameter">iterations</replaceable> ] ]</literal></term>

This set of changes is not reflected in the documentation.

With an interval in place, we could now automate some tests with
\watch where it does not fail. What do you think about adding a test
with a simple query, an interval of 0s and one iteration?
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Melanie Plageman 2023-03-16 01:03:10 Re: Option to not use ringbuffer in VACUUM, using it in failsafe mode
Previous Message Michael Paquier 2023-03-16 00:39:13 Re: Add a hook to allow modification of the ldapbindpasswd