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

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(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-21 09:37:36
Message-ID: CAFj8pRCuWQFcxcBXUrdDQ_52zTYF9LjGdhUA2HHYuBXC_ACDww@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

ne 21. 3. 2021 v 0:42 odesílatel Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
napsal:

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

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-03-21 09:47:00 Re: Logical Replication vs. 2PC
Previous Message Tatsuo Ishii 2021-03-21 09:30:59 Re: Using COPY FREEZE in pgbench