Re: Prevent psql \watch from running queries that return no rows

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Greg Sabino Mullane <htamfids@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2023-06-03T21:58:46Z
Lists: pgsql-hackers
On Fri, Jun 02, 2023 at 11:47:16AM -0400, Greg Sabino Mullane wrote:
> * Not completely convinced of the name "zero" (better than
> "stop_when_no_rows_returned"). Considered adding a new x=y argument, or
> overloading c (c=-1) but neither seemed very intuitive. On the other hand,
> it's tempting to stick to a single method moving forward, although this is
> a boolean option not a x=y one like the other two.

Wouldn't something like a target_rows be more flexible?  You could use
this parameter with a target number of rows to expect, zero being one
choice in that.
--
Michael

Commits

  1. Allow \watch queries to stop on minimum rows returned