Re: proposal - psql - use pager for \watch command

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal - psql - use pager for \watch command
Date: 2021-03-20 23:41:54
Message-ID: CA+hUKG+Hxyd38uvzvBwytSGPJ8-xMQt9uGHLNYSK3hEsdSTD2A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Mar 21, 2021 at 11:44 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)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).

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2021-03-20 23:47:24 Re: pspg pager is finished
Previous Message Tomas Vondra 2021-03-20 23:30:18 Re: [HACKERS] Custom compression methods