summaryrefslogtreecommitdiff
path: root/doc/src/sgml/ref/psql-ref.sgml
diff options
context:
space:
mode:
authorDaniel Gustafsson2023-08-29 09:30:11 +0000
committerDaniel Gustafsson2023-08-29 09:30:11 +0000
commitf347ec76e2a227e5c5b5065cce7adad16d58d209 (patch)
tree0d03e7a4caa335a0b9ae014299ccabbac8486c3f /doc/src/sgml/ref/psql-ref.sgml
parent95fff2abee66c16ca3609b3c1638cbd553730a90 (diff)
Allow \watch queries to stop on minimum rows returned
When running a repeat query with \watch in psql, it can be helpful to be able to stop the watch process when the query no longer returns the expected amount of rows. An example would be to watch for the presence of a certain event in pg_stat_activity and stopping when the event is no longer present, or to watch an index creation and stop when the index is created. This adds a min_rows=MIN parameter to \watch which can be set to a non-negative integer, and the watch query will stop executing when it returns less than MIN rows. Author: Greg Sabino Mullane <[email protected]> Reviewed-by: Michael Paquier <[email protected]> Reviewed-by: Daniel Gustafsson <[email protected]> Discussion: https://postgr.es/m/CAKAnmmKStATuddYxP71L+p0DHtp9Rvjze3XRoy0Dyw67VQ45UA@mail.gmail.com
Diffstat (limited to 'doc/src/sgml/ref/psql-ref.sgml')
-rw-r--r--doc/src/sgml/ref/psql-ref.sgml7
1 files changed, 4 insertions, 3 deletions
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 182e58353f1..d94e3cacfcc 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -3566,13 +3566,14 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
<varlistentry id="app-psql-meta-command-watch">
- <term><literal>\watch [ i[nterval]=<replaceable class="parameter">seconds</replaceable> ] [ c[ount]=<replaceable class="parameter">times</replaceable> ] [ <replaceable class="parameter">seconds</replaceable> ]</literal></term>
+ <term><literal>\watch [ i[nterval]=<replaceable class="parameter">seconds</replaceable> ] [ c[ount]=<replaceable class="parameter">times</replaceable> ] [ m[in_rows]=<replaceable class="parameter">rows</replaceable> ] [ <replaceable class="parameter">seconds</replaceable> ]</literal></term>
<listitem>
<para>
Repeatedly execute the current query buffer (as <literal>\g</literal> does)
until interrupted, or the query fails, or the execution count limit
- (if given) is reached. Wait the specified number of
- seconds (default 2) between executions. For backwards compatibility,
+ (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.
+ For backwards compatibility,
<replaceable class="parameter">seconds</replaceable> can be specified
with or without an <literal>interval=</literal> prefix.
Each query result is