aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/common.h
diff options
context:
space:
mode:
authorDaniel Gustafsson <dgustafsson@postgresql.org>2023-08-29 11:30:11 +0200
committerDaniel Gustafsson <dgustafsson@postgresql.org>2023-08-29 11:30:11 +0200
commitf347ec76e2a227e5c5b5065cce7adad16d58d209 (patch)
tree0d03e7a4caa335a0b9ae014299ccabbac8486c3f /src/bin/psql/common.h
parent95fff2abee66c16ca3609b3c1638cbd553730a90 (diff)
downloadpostgresql-f347ec76e2a227e5c5b5065cce7adad16d58d209.tar.gz
postgresql-f347ec76e2a227e5c5b5065cce7adad16d58d209.zip
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
Diffstat (limited to 'src/bin/psql/common.h')
-rw-r--r--src/bin/psql/common.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bin/psql/common.h b/src/bin/psql/common.h
index 812b94a9775..a16c56b405b 100644
--- a/src/bin/psql/common.h
+++ b/src/bin/psql/common.h
@@ -32,7 +32,7 @@ extern void psql_setup_cancel_handler(void);
extern void SetShellResultVariables(int wait_result);
extern PGresult *PSQLexec(const char *query);
-extern int PSQLexecWatch(const char *query, const printQueryOpt *opt, FILE *printQueryFout);
+extern int PSQLexecWatch(const char *query, const printQueryOpt *opt, FILE *printQueryFout, int min_rows);
extern bool SendQuery(const char *query);