pgsql: Allow \watch queries to stop on minimum rows returned - Mailing list pgsql-committers

From Daniel Gustafsson
Subject pgsql: Allow \watch queries to stop on minimum rows returned
Date
Msg-id E1qav8G-001VJf-SN@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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 <htamfids@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/CAKAnmmKStATuddYxP71L+p0DHtp9Rvjze3XRoy0Dyw67VQ45UA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f347ec76e2a227e5c5b5065cce7adad16d58d209

Modified Files
--------------
doc/src/sgml/ref/psql-ref.sgml |  7 ++++---
src/bin/psql/command.c         | 32 +++++++++++++++++++++++++++-----
src/bin/psql/common.c          | 19 ++++++++++++++-----
src/bin/psql/common.h          |  2 +-
src/bin/psql/help.c            |  4 +++-
src/bin/psql/t/001_basic.pl    | 23 +++++++++++++++++++++++
6 files changed, 72 insertions(+), 15 deletions(-)


pgsql-committers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: pgsql: Reword user-facing message for "power of two"
Next
From: Daniel Gustafsson
Date:
Subject: pgsql: Reword user-facing message for "power of two"