Re: psql's \watch is broken

2019-12-16 Thread Michael Paquier
On Mon, Dec 16, 2019 at 11:40:07AM +0900, Michael Paquier wrote: > As the concepts behind cancel_pressed and CancelRequested are > different, we need to keep cancel_pressed and make psql use it. And > the callback used for WIN32 also needs to set the flag. I also think > that we should do a

Re: psql's \watch is broken

2019-12-15 Thread Michael Paquier
On Sun, Dec 15, 2019 at 10:35:54PM +0100, Fabien COELHO wrote: >> Also, perhaps I am missing something, but I do not see anyplace in the >> current code base that ever *clears* CancelRequested. For bin/scripts/, that's not really a problem, because all code paths triggering a cancellation, aka in

Re: psql's \watch is broken

2019-12-15 Thread Fabien COELHO
Hello Tom, My 0.02 €: Given the rather small number of existing uses of CancelRequested, I wonder if it wouldn't be a better idea to rename it to cancel_pressed? I prefer the former because it is more functional (a cancellation has been requested, however the mean to do so) while "pressed"

Re: psql's \watch is broken

2019-12-15 Thread Tom Lane
Michael Paquier writes: > Looked at it already. And yes, I can see the difference. This comes > from the switch from cancel_pressed to CancelRequested in psql, > especially PSQLexecWatch() in this case. And actually, now that I > look at it, I think that we should simply get rid of

Re: psql's \watch is broken

2019-12-14 Thread Fabien COELHO
I've not dug into code itself, I just bisected it. Thanks for the report. I'll look into it. Looked at it already. Ah, the magic of timezones! And yes, I can see the difference. This comes from the switch from cancel_pressed to CancelRequested in psql, especially PSQLexecWatch() in

Re: psql's \watch is broken

2019-12-13 Thread Jeff Janes
On Fri, Dec 13, 2019 at 9:45 PM Michael Paquier wrote: > On Sat, Dec 14, 2019 at 12:09:51AM +0100, Fabien COELHO wrote: > > > >> explain (analyze) select * from pgbench_accounts \watch 1 > >> > >> It behaves as expected. But once I break out of the loop with ctrl-C, > then > >> if I execute the

Re: psql's \watch is broken

2019-12-13 Thread Michael Paquier
On Sat, Dec 14, 2019 at 12:09:51AM +0100, Fabien COELHO wrote: > >> explain (analyze) select * from pgbench_accounts \watch 1 >> >> It behaves as expected. But once I break out of the loop with ctrl-C, then >> if I execute the same thing again it executes the command once, but shows >> no

Re: psql's \watch is broken

2019-12-13 Thread Fabien COELHO
explain (analyze) select * from pgbench_accounts \watch 1 It behaves as expected. But once I break out of the loop with ctrl-C, then if I execute the same thing again it executes the command once, but shows no output and doesn't loop. It seems like some flag is getting set with ctrl-C, but

psql's \watch is broken

2019-12-13 Thread Jeff Janes
If I do something like this: explain (analyze) select * from pgbench_accounts \watch 1 It behaves as expected. But once I break out of the loop with ctrl-C, then if I execute the same thing again it executes the command once, but shows no output and doesn't loop. It seems like some flag is