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

2022-06-06 Thread Pavel Stehule
út 7. 6. 2022 v 6:50 odesílatel Thomas Munro napsal: > On Tue, Jun 7, 2022 at 3:23 PM Tom Lane wrote: > > The code needs a comment about why it's emitting a newline, though. > > In particular, it had better explain why that should be conditional > > on !pagerpipe, because that makes no sense to

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

2022-06-06 Thread Thomas Munro
On Tue, Jun 7, 2022 at 3:23 PM Tom Lane wrote: > The code needs a comment about why it's emitting a newline, though. > In particular, it had better explain why that should be conditional > on !pagerpipe, because that makes no sense to me. Yeah. OK, here's my take: + /* +

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

2022-06-06 Thread Tom Lane
Thomas Munro writes: > On Mon, May 9, 2022 at 7:07 PM Pavel Stehule wrote: >> út 13. 7. 2021 v 19:50 odesílatel Tom Lane napsal: >>> ^C\watch cancelled >>> regression=# > Do we really need the extra text? What about just \n, so you get: > postgres=# \watch 1 > ...blah blah... > ^C > postgres=

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

2022-06-06 Thread Thomas Munro
On Mon, May 9, 2022 at 7:07 PM Pavel Stehule wrote: > út 13. 7. 2021 v 19:50 odesílatel Tom Lane napsal: >> ^Cregression=# >> >> then as you can see I get nothing but the "^C" echo before the next >> psql prompt. The problem with this is that now libreadline is >> misinformed about the cursor po

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

2022-05-09 Thread Pavel Stehule
Hi út 13. 7. 2021 v 19:50 odesílatel Tom Lane napsal: > Thomas Munro writes: > > Pushed, after retesting on macOS (with the fixed pspg that has by now > > arrived in MacPorts), FreeBSD and Linux. Thanks! > > After playing with this along the way to fixing the sigwait issues, > I have a gripe/s

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

2022-03-24 Thread Pavel Stehule
čt 24. 3. 2022 v 11:05 odesílatel Thomas Munro napsal: > On Wed, Jul 14, 2021 at 6:06 AM Pavel Stehule > wrote: > > út 13. 7. 2021 v 19:50 odesílatel Tom Lane napsal: > >> After playing with this along the way to fixing the sigwait issues, > >> I have a gripe/suggestion. If I hit control-C whi

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

2022-03-24 Thread Thomas Munro
On Wed, Jul 14, 2021 at 6:06 AM Pavel Stehule wrote: > út 13. 7. 2021 v 19:50 odesílatel Tom Lane napsal: >> After playing with this along the way to fixing the sigwait issues, >> I have a gripe/suggestion. If I hit control-C while the thing >> is waiting between queries, eg >> >> regression=# s

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

2021-07-13 Thread Pavel Stehule
út 13. 7. 2021 v 19:50 odesílatel Tom Lane napsal: > Thomas Munro writes: > > Pushed, after retesting on macOS (with the fixed pspg that has by now > > arrived in MacPorts), FreeBSD and Linux. Thanks! > > After playing with this along the way to fixing the sigwait issues, > I have a gripe/sugge

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

2021-07-13 Thread Tom Lane
Thomas Munro writes: > Pushed, after retesting on macOS (with the fixed pspg that has by now > arrived in MacPorts), FreeBSD and Linux. Thanks! After playing with this along the way to fixing the sigwait issues, I have a gripe/suggestion. If I hit control-C while the thing is waiting between qu

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

2021-07-12 Thread Pavel Stehule
út 13. 7. 2021 v 2:01 odesílatel Thomas Munro napsal: > On Tue, Jul 13, 2021 at 8:20 AM Pavel Stehule > wrote: > > po 12. 7. 2021 v 18:12 odesílatel vignesh C > napsal: > >> Thanks for fixing the comments, CFbot also passes for the same. I have > >> changed the status back to "Ready for Committ

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

2021-07-12 Thread Thomas Munro
On Tue, Jul 13, 2021 at 8:20 AM Pavel Stehule wrote: > po 12. 7. 2021 v 18:12 odesílatel vignesh C napsal: >> Thanks for fixing the comments, CFbot also passes for the same. I have >> changed the status back to "Ready for Committer". > > I tested this version with the last release and with a deve

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

2021-07-12 Thread Pavel Stehule
po 12. 7. 2021 v 18:12 odesílatel vignesh C napsal: > On Mon, Jul 12, 2021 at 4:29 AM Thomas Munro > wrote: > > > > On Sun, Jul 11, 2021 at 1:18 AM vignesh C wrote: > > > On Wed, May 12, 2021 at 5:45 PM Pavel Stehule > wrote: > > > > looks so with your patch psql doesn't work on ms > > > > Her

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

2021-07-12 Thread vignesh C
On Mon, Jul 12, 2021 at 4:29 AM Thomas Munro wrote: > > On Sun, Jul 11, 2021 at 1:18 AM vignesh C wrote: > > On Wed, May 12, 2021 at 5:45 PM Pavel Stehule > > wrote: > > > looks so with your patch psql doesn't work on ms > > Here's a fix for Windows. The pqsignal() calls are #ifdef'd out. I >

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

2021-07-11 Thread Thomas Munro
On Sun, Jul 11, 2021 at 1:18 AM vignesh C wrote: > On Wed, May 12, 2021 at 5:45 PM Pavel Stehule wrote: > > looks so with your patch psql doesn't work on ms Here's a fix for Windows. The pqsignal() calls are #ifdef'd out. I also removed a few lines that were added after commit 3a513067 but are

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

2021-07-10 Thread vignesh C
On Wed, May 12, 2021 at 5:45 PM Pavel Stehule wrote: > > > > st 12. 5. 2021 v 12:25 odesílatel Pavel Stehule > napsal: >> >> Hi >> >> st 21. 4. 2021 v 8:52 odesílatel Pavel Stehule >> napsal: >>> >>> >>> >>> st 21. 4. 2021 v 8:49 odesílatel Thomas Munro >>> napsal: On Wed, Apr 21,

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

2021-05-12 Thread Pavel Stehule
st 12. 5. 2021 v 12:25 odesílatel Pavel Stehule napsal: > Hi > > st 21. 4. 2021 v 8:52 odesílatel Pavel Stehule > napsal: > >> >> >> st 21. 4. 2021 v 8:49 odesílatel Thomas Munro >> napsal: >> >>> On Wed, Apr 21, 2021 at 6:33 PM Pavel Stehule >>> wrote: >>> > here is an rebase of Thomas's impl

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

2021-05-12 Thread Pavel Stehule
Hi st 21. 4. 2021 v 8:52 odesílatel Pavel Stehule napsal: > > > st 21. 4. 2021 v 8:49 odesílatel Thomas Munro > napsal: > >> On Wed, Apr 21, 2021 at 6:33 PM Pavel Stehule >> wrote: >> > here is an rebase of Thomas's implementation >> >> Thanks. I finished up not committing that one for 14 bec

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

2021-04-20 Thread Pavel Stehule
st 21. 4. 2021 v 8:49 odesílatel Thomas Munro napsal: > On Wed, Apr 21, 2021 at 6:33 PM Pavel Stehule > wrote: > > here is an rebase of Thomas's implementation > > Thanks. I finished up not committing that one for 14 because I wasn't > sure about the way to rebase it on top of 3a513067 (now rev

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

2021-04-20 Thread Thomas Munro
On Wed, Apr 21, 2021 at 6:33 PM Pavel Stehule wrote: > here is an rebase of Thomas's implementation Thanks. I finished up not committing that one for 14 because I wasn't sure about the way to rebase it on top of 3a513067 (now reverted); that "restore" stuff seemed a bit weird. Let's try again i

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

2021-04-20 Thread Pavel Stehule
Hi čt 8. 4. 2021 v 1:38 odesílatel Thomas Munro napsal: > 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 PSQLexecW

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

2021-04-07 Thread Thomas Munro
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) + { + rest

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

2021-03-23 Thread Pavel Stehule
po 22. 3. 2021 v 13:13 odesílatel Thomas Munro napsal: > On Mon, Mar 22, 2021 at 5:10 PM Pavel Stehule > wrote: > > probably there will not be an issue inside ncurses - the most complex > part of get_event is polling of input sources - tty and some other. The > pspg should not to stop there on t

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

2021-03-22 Thread Pavel Stehule
út 23. 3. 2021 v 0:35 odesílatel Thomas Munro napsal: > On Sun, Mar 21, 2021 at 11:43 PM Pavel Stehule > wrote: > > so 20. 3. 2021 v 23:45 odesílatel Thomas Munro > napsal: > >> Thoughts? I put my changes into a separate patch for clarity, but > >> they need some more tidying up. > > > > yes,

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

2021-03-22 Thread Pavel Stehule
po 22. 3. 2021 v 22:07 odesílatel Thomas Munro napsal: > On Tue, Mar 23, 2021 at 1:53 AM Pavel Stehule > wrote: > > po 22. 3. 2021 v 13:13 odesílatel Thomas Munro > napsal: > >> The problem is that Apple's /dev/tty device is defective, and doesn't > >> work in poll(). It always returns immedia

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

2021-03-22 Thread Thomas Munro
On Sun, Mar 21, 2021 at 11:43 PM Pavel Stehule wrote: > so 20. 3. 2021 v 23:45 odesílatel Thomas Munro > napsal: >> Thoughts? I put my changes into a separate patch for clarity, but >> they need some more tidying up. > > yes, your solution is much better. Hmm, there was a problem with it thoug

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

2021-03-22 Thread Thomas Munro
On Tue, Mar 23, 2021 at 1:53 AM Pavel Stehule wrote: > po 22. 3. 2021 v 13:13 odesílatel Thomas Munro > napsal: >> The problem is that Apple's /dev/tty device is defective, and doesn't >> work in poll(). It always returns immediately with revents=POLLNVAL, >> but pspg assumes that data is ready

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

2021-03-22 Thread Pavel Stehule
po 22. 3. 2021 v 13:13 odesílatel Thomas Munro napsal: > On Mon, Mar 22, 2021 at 5:10 PM Pavel Stehule > wrote: > > probably there will not be an issue inside ncurses - the most complex > part of get_event is polling of input sources - tty and some other. The > pspg should not to stop there on t

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

2021-03-22 Thread Thomas Munro
On Mon, Mar 22, 2021 at 5:10 PM Pavel Stehule wrote: > probably there will not be an issue inside ncurses - the most complex part of > get_event is polling of input sources - tty and some other. The pspg should > not to stop there on tty reading. The problem is that Apple's /dev/tty device is d

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

2021-03-21 Thread Pavel Stehule
po 22. 3. 2021 v 4:55 odesílatel Thomas Munro napsal: > On Sun, Mar 21, 2021 at 10:38 PM Pavel Stehule > wrote: > > Can somebody help me (with access on macos0 with debugging this issue? > > I'll try to figure it out, but maybe after the code freeze. I started > my programming career writing cu

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

2021-03-21 Thread Thomas Munro
On Sun, Mar 21, 2021 at 10:38 PM Pavel Stehule wrote: > Can somebody help me (with access on macos0 with debugging this issue? I'll try to figure it out, but maybe after the code freeze. I started my programming career writing curses software a million years ago on a couple of extinct Unixes...

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

2021-03-21 Thread Pavel Stehule
so 20. 3. 2021 v 23:45 odesílatel Thomas Munro napsal: > On Thu, Mar 4, 2021 at 11:28 PM Pavel Stehule > wrote: > > čt 4. 3. 2021 v 7:37 odesílatel Pavel Stehule > napsal: > >> Here is a little bit updated patch - detection of end of any child > process cannot be used on WIN32. > > Yeah, it's O

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

2021-03-21 Thread Pavel Stehule
ne 21. 3. 2021 v 0:42 odesílatel Thomas Munro napsal: > On Sun, Mar 21, 2021 at 11:44 AM Thomas Munro > 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 assu

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

2021-03-20 Thread Thomas Munro
On Sun, Mar 21, 2021 at 11:44 AM Thomas Munro 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 h

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

2021-03-20 Thread Thomas Munro
On Thu, Mar 4, 2021 at 11:28 PM Pavel Stehule wrote: > čt 4. 3. 2021 v 7:37 odesílatel Pavel Stehule > napsal: >> Here is a little bit updated patch - detection of end of any child process >> cannot be used on WIN32. Yeah, it's OK for me if this feature only works on Unix until the right perso

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

2021-03-04 Thread Pavel Stehule
Hi čt 4. 3. 2021 v 7:37 odesílatel Pavel Stehule napsal: > Hi > > Here is a little bit updated patch - detection of end of any child process > cannot be used on WIN32. I am not an expert on this platform, but from what > I read about it, there is no easy solution. The problem is in _popen > func

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

2021-03-03 Thread Pavel Stehule
Hi Here is a little bit updated patch - detection of end of any child process cannot be used on WIN32. I am not an expert on this platform, but from what I read about it, there is no easy solution. The problem is in _popen function. We lost the handle of the created process, and it is not possible

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

2021-03-03 Thread Pavel Stehule
Hi út 16. 2. 2021 v 2:49 odesílatel Thomas Munro napsal: > On Fri, Jan 8, 2021 at 10:36 PM Pavel Stehule > wrote: > > ne 19. 4. 2020 v 19:27 odesílatel Pavel Stehule > napsal: > >> last week I finished pspg 3.0 https://github.com/okbob/pspg . pspg now > supports pipes, named pipes very well. T

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

2021-02-18 Thread Pavel Stehule
Hi út 16. 2. 2021 v 2:49 odesílatel Thomas Munro napsal: > On Fri, Jan 8, 2021 at 10:36 PM Pavel Stehule > wrote: > > ne 19. 4. 2020 v 19:27 odesílatel Pavel Stehule > napsal: > >> last week I finished pspg 3.0 https://github.com/okbob/pspg . pspg now > supports pipes, named pipes very well. T

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

2021-02-15 Thread Thomas Munro
On Fri, Jan 8, 2021 at 10:36 PM Pavel Stehule wrote: > ne 19. 4. 2020 v 19:27 odesílatel Pavel Stehule > napsal: >> last week I finished pspg 3.0 https://github.com/okbob/pspg . pspg now >> supports pipes, named pipes very well. Today the pspg can be used as pager >> for output of \watch comma

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

2021-01-08 Thread Pavel Stehule
ne 19. 4. 2020 v 19:27 odesílatel Pavel Stehule napsal: > Hi, > > last week I finished pspg 3.0 https://github.com/okbob/pspg . pspg now > supports pipes, named pipes very well. Today the pspg can be used as pager > for output of \watch command. Sure, psql needs attached patch. > > I propose new

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

2020-07-01 Thread Pavel Stehule
st 1. 7. 2020 v 22:41 odesílatel Tom Lane napsal: > Pavel Stehule writes: > > I propose new psql environment variable PSQL_WATCH_PAGER. When this > > variable is not empty, then \watch command starts specified pager, and > > redirect output to related pipe. When pipe is closed - by pager, then >

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

2020-07-01 Thread Tom Lane
Pavel Stehule writes: > I propose new psql environment variable PSQL_WATCH_PAGER. When this > variable is not empty, then \watch command starts specified pager, and > redirect output to related pipe. When pipe is closed - by pager, then > \watch cycle is leaved. I dunno, this just seems really st

proposal - psql - use pager for \watch command

2020-04-19 Thread Pavel Stehule
Hi, last week I finished pspg 3.0 https://github.com/okbob/pspg . pspg now supports pipes, named pipes very well. Today the pspg can be used as pager for output of \watch command. Sure, psql needs attached patch. I propose new psql environment variable PSQL_WATCH_PAGER. When this variable is not