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

2023-08-29 Thread Daniel Gustafsson
> On 22 Aug 2023, at 23:23, Greg Sabino Mullane wrote: > > Thank you for the feedback, everyone. Attached is version 4 of the patch, > featuring a few tests and minor rewordings. I went over this once more, and pushed it along with pgindenting. I did reduce the number of tests since they were

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

2023-08-28 Thread Daniel Gustafsson
> On 22 Aug 2023, at 23:23, Greg Sabino Mullane wrote: > > Thank you for the feedback, everyone. Attached is version 4 of the patch, > featuring a few tests and minor rewordings. I had another look, and did some playing around with this and I think this version is ready to go in, so I will try

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

2023-08-22 Thread Daniel Gustafsson
> On 22 Aug 2023, at 23:23, Greg Sabino Mullane wrote: > > Thank you for the feedback, everyone. Attached is version 4 of the patch, > featuring a few tests and minor rewordings. Thanks, the changes seem good from a quick skim. I'll take a better look tomorrow to hopefully close this one. --

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

2023-08-22 Thread Greg Sabino Mullane
Thank you for the feedback, everyone. Attached is version 4 of the patch, featuring a few tests and minor rewordings. Cheers, Greg psql_watch_exit_on_zero_rows_v4.patch Description: Binary data

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

2023-07-25 Thread Michael Paquier
On Wed, Jul 05, 2023 at 10:14:22AM -0400, Greg Sabino Mullane wrote: > Would like to hear others weigh in, I think it's still only three states > plus a default, so I'm not convinced it warrants multiple statements yet. :) I find that hard to parse, so having more lines to get a better idea of

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

2023-07-05 Thread Greg Sabino Mullane
Thanks for the feedback! On Wed, Jul 5, 2023 at 5:51 AM Daniel Gustafsson wrote: > > The comment on ExecQueryAndProcessResults() needs to be updated with an > explanation of what this parameter is. > I added a comment in the place where min_rows is used, but not sure what you mean by adding it

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

2023-07-05 Thread Daniel Gustafsson
> On 4 Jun 2023, at 20:55, Greg Sabino Mullane wrote: > > On Sat, Jun 3, 2023 at 5:58 PM Michael Paquier wrote: > > 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. > > Thank you!

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

2023-06-04 Thread Greg Sabino Mullane
On Sat, Jun 3, 2023 at 5:58 PM Michael Paquier wrote: > > 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. > Thank you! That does feel better to me. Please see attached a new v2 patch

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

2023-06-03 Thread Michael Paquier
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

Prevent psql \watch from running queries that return no rows

2023-06-02 Thread Greg Sabino Mullane
Attached is a patch to allow a new behavior for the \watch command in psql. When enabled, this instructs \watch to stop running once the query returns zero rows. The use case is the scenario in which you are watching the output of something long-running such as pg_stat_progress_create_index, but