From: Daniel Gustafsson <dgustafsson@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Allow \watch queries to stop on minimum rows returned
Date: Tue, 29 Aug 2023 09:35:33 +0000
Message-ID: <E1qav8G-001VJf-SN@gemulon.postgresql.org> (raw)
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(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: dgustafsson@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Allow \watch queries to stop on minimum rows returned
In-Reply-To: <E1qav8G-001VJf-SN@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox