Re: pgsql: Add PSQL_WATCH_PAGER for psql's \watch command.

2021-07-14 Thread Thomas Munro
On Thu, Jul 15, 2021 at 4:07 AM Tom Lane wrote: > I've tested the attached on the GCC farm's Solaris machine (which > I believe is the same machine wrasse runs on), and it seems OK. > I think it's ready to go. Pushed. Thanks!

Re: pgsql: Add PSQL_WATCH_PAGER for psql's \watch command.

2021-07-14 Thread Tom Lane
Thomas Munro writes: > I decided to try to make it work properly on that OS instead of the > hacky solution now that I have access. I took your last patch, moved > -D_POSIX_PTHREAD_SEMANTICS into CFLAGS in src/template/solaris, Aha! Yeah, just defining _POSIX_PTHREAD_SEMANTICS unconditionally o

Re: pgsql: Add PSQL_WATCH_PAGER for psql's \watch command.

2021-07-14 Thread Thomas Munro
On Wed, Jul 14, 2021 at 4:08 PM Thomas Munro wrote: > On Wed, Jul 14, 2021 at 6:17 AM Tom Lane wrote: > > (I suppose a hacky solution might be to never define USE_SIGWAIT > > on Solaris.) > > Yeah I was thinking about that. I've just got a shell on an illumos > VM and will try a couple of ideas

Re: pgsql: Add PSQL_WATCH_PAGER for psql's \watch command.

2021-07-13 Thread Thomas Munro
On Wed, Jul 14, 2021 at 6:17 AM Tom Lane wrote: > Just how badly did you want to use sigwait here? I'm having > considerable second thoughts about the value of that change > versus the hoops we're going to have to jump through to use it. I'm sure I could find another way if it comes to it. The

Re: pgsql: Add PSQL_WATCH_PAGER for psql's \watch command.

2021-07-13 Thread Tom Lane
I wrote: > Here's a revised patch that I've tested (albeit lightly) on > both HPUX and Solaris. Hm, I'd verified the configure results, but I didn't wait around for the builds to finish, which was a mistake. On Solaris 11: command.c: In function 'do_watch': command.c:5062:8: error: too many argu

Re: pgsql: Add PSQL_WATCH_PAGER for psql's \watch command.

2021-07-13 Thread Tom Lane
Thomas Munro writes: > Here's a better patch. I didn't like the way you'd done this as two independent tests; the second one falsely reports success if there isn't actually any declaration of sigwait. I see you hacked around that by checking both results in c.h, but the printed result is still v

Re: pgsql: Add PSQL_WATCH_PAGER for psql's \watch command.

2021-07-13 Thread Thomas Munro
Here's a better patch. I check if there is any declaration at all, which ancient HPUX should fail based on: command.c:5062:4: warning: implicit declaration of function 'sigwait' Then I also check that there isn't an incompatible declaration with the technique from thread_test.c, which Solaris sh

Re: pgsql: Add PSQL_WATCH_PAGER for psql's \watch command.

2021-07-12 Thread Thomas Munro
On Tue, Jul 13, 2021 at 5:18 PM Thomas Munro wrote: > https://illumos.org/man/2/sigwait > https://docs.oracle.com/cd/E36784_01/html/E36872/sigwait-2.html Oh, hmm, that's something we already have to do elsewhere to get standard conforming interfaces on that platform: # Some platforms use these,

Re: pgsql: Add PSQL_WATCH_PAGER for psql's \watch command.

2021-07-12 Thread Thomas Munro
On Tue, Jul 13, 2021 at 4:15 PM Tom Lane wrote: > Huh ... gaur did this: > > /usr/ccs/bin/ld: Unsatisfied symbols: >sigwait (code) > > which is not what I was expecting, because there is a definition for > sigwait in /usr/include (though not in a header file we use). It must > be in some add-

Re: pgsql: Add PSQL_WATCH_PAGER for psql's \watch command.

2021-07-12 Thread Tom Lane
Thomas Munro writes: > On Tue, Jul 13, 2021 at 1:09 PM Tom Lane wrote: >> That won't help as-is, because it *does* have sigwait, just not with >> the POSIX API. thread_test.c does this: >> >> /* Test for POSIX.1c 2-arg sigwait() and fail on single-arg version */ >> #include >> int

Re: pgsql: Add PSQL_WATCH_PAGER for psql's \watch command.

2021-07-12 Thread Thomas Munro
On Tue, Jul 13, 2021 at 1:09 PM Tom Lane wrote: > Thomas Munro writes: > > Oh, thanks for the advance warning. Wouldn't HAVE_SIGWAIT be better? > > Like so. > > That won't help as-is, because it *does* have sigwait, just not with > the POSIX API. thread_test.c does this: > > /* Test for POSI

Re: pgsql: Add PSQL_WATCH_PAGER for psql's \watch command.

2021-07-12 Thread Tom Lane
Thomas Munro writes: > On Tue, Jul 13, 2021 at 12:30 PM Tom Lane wrote: >> I think this is going to fall over on gaur, which doesn't have POSIX-style >> sigwait. > Oh, thanks for the advance warning. Wouldn't HAVE_SIGWAIT be better? Like > so. That won't help as-is, because it *does* have s

Re: pgsql: Add PSQL_WATCH_PAGER for psql's \watch command.

2021-07-12 Thread Thomas Munro
On Tue, Jul 13, 2021 at 12:30 PM Tom Lane wrote: > > Thomas Munro writes: > > To make \watch react quickly when the user quits the pager or presses > > ^C, and also to increase the accuracy of its timing and decrease the > > rate of useless context switches, change the main loop of the \watch > >

Re: pgsql: Add PSQL_WATCH_PAGER for psql's \watch command.

2021-07-12 Thread Tom Lane
Thomas Munro writes: > To make \watch react quickly when the user quits the pager or presses > ^C, and also to increase the accuracy of its timing and decrease the > rate of useless context switches, change the main loop of the \watch > command to use sigwait() rather than a sleeping/polling loop,

pgsql: Add PSQL_WATCH_PAGER for psql's \watch command.

2021-07-12 Thread Thomas Munro
Add PSQL_WATCH_PAGER for psql's \watch command. Allow a pager to be used by the \watch command. This works but isn't very useful with traditional pagers like "less", so use a different environment variable. The popular open source tool "pspg" (also by Pavel) knows how to display the output if yo