Re: proposal - psql - use pager for \watch command
Thomas Munro <thomas.munro@gmail.com>
From: Thomas Munro <thomas.munro@gmail.com>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2021-04-07T23:37:36Z
Lists: pgsql-hackers
Attachments
- v5-0001-Add-PSQL_WATCH_PAGER-for-psql-s-watch-command.patch (text/x-patch) patch v5-0001
Here's a rebase, due to a conflict with 3a513067 "psql: Show all query
results by default" which moved a few things around making it harder
to use the pager for the right scope. Lacking time, I came up with
this change to PSQLexecWatch():
+ if (printQueryFout)
+ {
+ restoreQueryFout = pset.queryFout;
+ pset.queryFout = printQueryFout;
+ }
+
SetCancelConn(pset.db);
res = SendQueryAndProcessResults(query, &elapsed_msec, true);
ResetCancelConn();
fflush(pset.queryFout);
+ if (restoreQueryFout)
+ pset.queryFout = restoreQueryFout;
+
If someone has a tidier way to factor this, I'm keen to hear it. I'd
like to push this today.
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