Re: proposal - psql - use pager for \watch command - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: proposal - psql - use pager for \watch command
Date
Msg-id CAFj8pRCuWQFcxcBXUrdDQ_52zTYF9LjGdhUA2HHYuBXC_ACDww@mail.gmail.com
Whole thread Raw
In response to Re: proposal - psql - use pager for \watch command  (Thomas Munro <thomas.munro@gmail.com>)
Responses Re: proposal - psql - use pager for \watch command
List pgsql-hackers


ne 21. 3. 2021 v 0:42 odesílatel Thomas Munro <thomas.munro@gmail.com> napsal:
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.

I  do not have a Mac, so I never tested these features there. Surelly, something is wrong, but I have no idea what.

1. pspg call timeout function with value 1000. So maximal waiting time anywhere should be 1 sec

2. For this case, the pool function should be called, and timeout is detected from the result value of the pool function.

So it looks like the pool function has a little bit different behavior than I expect.

Can somebody help me (with access on macos0 with debugging this issue?

Regards

Pavel




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).

pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: Using COPY FREEZE in pgbench
Next
From: Amit Kapila
Date:
Subject: Re: Logical Replication vs. 2PC