1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

psql: Make default \watch interval configurable

The default interval for \watch to wait between executing queries,
when executed without a specified interval, was hardcoded to two
seconds.  This adds the new variable WATCH_INTERVAL which is used
to set the default interval, making it configurable for the user.
This makes \watch the first command which has a user configurable
default setting.

Author: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Masahiro Ikeda <ikedamsh@oss.nttdata.com>
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>
Reviewed-by: Greg Sabino Mullane <htamfids@gmail.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://postgr.es/m/B2FD26B4-8F64-4552-A603-5CC3DF1C7103@yesql.se
This commit is contained in:
Daniel Gustafsson
2025-03-25 17:53:33 +01:00
parent a19db08274
commit 1a759c8327
8 changed files with 141 additions and 2 deletions

View File

@ -3852,6 +3852,8 @@ SELECT 1 \bind \sendpipeline
until interrupted, or the query fails, or the execution count limit
(if given) is reached, or the query no longer returns the minimum number
of rows. Wait the specified number of seconds (default 2) between executions.
The default wait can be changed with the variable
<xref linkend="app-psql-variables-watch-interval"/>).
For backwards compatibility,
<replaceable class="parameter">seconds</replaceable> can be specified
with or without an <literal>interval=</literal> prefix.
@ -4746,6 +4748,17 @@ bar
</listitem>
</varlistentry>
<varlistentry id="app-psql-variables-watch-interval">
<term><varname>WATCH_INTERVAL</varname></term>
<listitem>
<para>
This variable sets the default interval which <command>\watch</command>
waits between executing the query. Specifying an interval in the
command overrides this variable.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect3>