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-03-20T23:41:54Z
Lists: pgsql-hackers
On Sun, Mar 21, 2021 at 11:44 AM Thomas Munro <thomas.munro@gmail.com> wrote:
> [review]
Oh, just BTW, to save confusion for others who might try this: It
seems there is something wrong with pspg --stream on macOS, at least
when using MacPorts. I assumed it might be just pspg 3.1.5 being too
old (that's what MacPorts has currently), so I didn't mention it
before, but I just built pspg from your github master branch and it
has the same symptom. It doesn't seem to repaint the screen until you
press a key. I can see that psql is doing its job, but pspg is
sitting in select() reached from ncurses wgetch():
* frame #0: 0x000000019b4af0e8 libsystem_kernel.dylib`__select + 8
frame #1: 0x0000000100ca0620 libncurses.6.dylib`_nc_timed_wait + 332
frame #2: 0x0000000100c85444 libncurses.6.dylib`_nc_wgetch + 296
frame #3: 0x0000000100c85b24 libncurses.6.dylib`wgetch + 52
frame #4: 0x0000000100a815e4 pspg`get_event + 624
frame #5: 0x0000000100a7899c pspg`main + 9640
frame #6: 0x000000019b4f9f34 libdyld.dylib`start + 4
That's using MacPorts' libncurses. I couldn't get it to build against
Apple's libcurses (some missing functions). It's the same for both
your V2 and the fixup I posted. When you press a key, it suddenly
catches up and repaints all the \watch updates that were buffered.
It works fine on Linux and FreeBSD though (I tried pspg 4.1.0 from
Debian's package manager, and pspg 4.3.1 from FreeBSD's).
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