Re: proposal - psql - use pager for \watch command
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>, vignesh C <vignesh21@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2021-07-13T17:50:38Z
Lists: pgsql-hackers
Thomas Munro <thomas.munro@gmail.com> writes:
> Pushed, after retesting on macOS (with the fixed pspg that has by now
> arrived in MacPorts), FreeBSD and Linux. Thanks!
After playing with this along the way to fixing the sigwait issues,
I have a gripe/suggestion. If I hit control-C while the thing
is waiting between queries, eg
regression=# select now() \watch
Tue Jul 13 13:44:44 2021 (every 2s)
now
-------------------------------
2021-07-13 13:44:44.396565-04
(1 row)
Tue Jul 13 13:44:46 2021 (every 2s)
now
-------------------------------
2021-07-13 13:44:46.396572-04
(1 row)
^Cregression=#
then as you can see I get nothing but the "^C" echo before the next
psql prompt. The problem with this is that now libreadline is
misinformed about the cursor position, messing up any editing I
might try to do on the next line of input. So I think it would
be a good idea to have some explicit final output when the \watch
command terminates, along the line of
...
Tue Jul 13 13:44:46 2021 (every 2s)
now
-------------------------------
2021-07-13 13:44:46.396572-04
(1 row)
^C\watch cancelled
regression=#
This strikes me as a usability improvement even without the
readline-confusion angle.
regards, tom lane
Commits
-
Fix \watch's interaction with libedit on ^C.
- 7c5953b7b5dc 10.22 landed
- 21ed12b14a32 11.17 landed
- 09224a35cdaa 12.12 landed
- e5b5b4448ce0 13.8 landed
- ab7fef0acfbd 14.5 landed
- 31b485f883a7 15.0 landed
- 21267b647719 16.0 landed
-
Add PSQL_WATCH_PAGER for psql's \watch command.
- 7c09d2797ecd 15.0 landed
-
psql: Show all query results by default
- 3a5130672296 14.0 cited
-
Add a comment warning against use of pg_usleep() for long sleeps.
- 8c1a71d36f5d 9.4.0 cited