pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: vignesh C <vignesh21@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: proposal - psql - use pager for \watch command
Date: Tue, 13 Jul 2021 13:50:38 -0400
Message-ID: <3278793.1626198638@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+hUKGLAyB0k4u_Rg9aoYg4+8BGuUY-UEz7vwxo3qOvm++NQKQ@mail.gmail.com>
References: <CAFj8pRBfzUUPz-3gN5oAzto9SDuRSq-TQPfXU_P6h0L7hO+Ehg@mail.gmail.com>
	<CAFj8pRA0ucvVfPmgON_XcofRgkdHBnceMKG3YQ34-s0m5g5ncg@mail.gmail.com>
	<CA+hUKGKA-2C2YsuJ9P=JsxUym8gkFOXOPmGEk7AUi9s9wDD5ZQ@mail.gmail.com>
	<CAFj8pRD0Ypmw2nH2Q0j0ZAUiMLWreDCNDm0wgNf13+GcOrO4eg@mail.gmail.com>
	<CAFj8pRAPSrp-z6bzasAE3M0XHMn1F3MQz46i99Dvcbfxa+uapQ@mail.gmail.com>
	<CAFj8pRAkReqHokfEGsZERHaCR8fP6E4UzE5MPeW2PgMqwarXSA@mail.gmail.com>
	<CA+hUKG+kLmjT9mzf0wr6=Xg=Cw+FjkT0ftyJGO9SnaYMiS8rmQ@mail.gmail.com>
	<CA+hUKG+Hxyd38uvzvBwytSGPJ8-xMQt9uGHLNYSK3hEsdSTD2A@mail.gmail.com>
	<CAFj8pRCuWQFcxcBXUrdDQ_52zTYF9LjGdhUA2HHYuBXC_ACDww@mail.gmail.com>
	<CA+hUKG+i=BsOO_OLMYWsPDg6Rrn+Ac0r++P5RpR8kHP+ojAATw@mail.gmail.com>
	<CAFj8pRBqB=Ajev7JDwnuLTdBvAXyWiegnUEx+PqxV=rpZCL9tg@mail.gmail.com>
	<CA+hUKGLsd9afMbDog8Bc6xfuTu8w0qJV06mtJmDDPZ7uw8=RbA@mail.gmail.com>
	<CAFj8pRCqzG0BU6OyDdx=8J-BM0TaoC7SdB-wsUzrc-M-1wT9hg@mail.gmail.com>
	<CA+hUKGK+j0_6SWwzPk0fiXwwAa7rMcx0dS-OdpyfdM=P4e+UUQ@mail.gmail.com>
	<CAFj8pRDZJ! QRUF5u=_MfaRCBQ+VB9NF+XNYv+0x=3GkryCFb8=w@mail.gmail.com>
	<CA+hUKG+cnOdwjxMEqt7tyMGRbtLNkY23NedshjT-hbXX9pK-Lg@mail.gmail.com>
	<CAFj8pRBUFg4Mtt_yTe-WSYcr7oojtdNUVQUkyEBcHUY5pjCYiQ@mail.gmail.com>
	<CAFj8pRCBwxiu9fYs42a4uY_L-pmv6-UfDjjAf3-pP5TNn-Dt2g@mail.gmail.com>
	<CAFj8pRCtbq4ECRhLLz9scjS+WGKmRYD=Kj+yyqYX1Qoot=jjZw@mail.gmail.com>
	<CALDaNm3NT5NgzEMVZGaF4xOGQ+UUkKkGaTEJ8Ss0EgqwSp0L8g@mail.gmail.com>
	<CA+hUKGLiXZweBfYtNTTK+Cpw61+-omksY1KZ0Nvby6rrswOVjQ@mail.gmail.com>
	<CALDaNm2sAKNC-X0cgxrKDJ6v+1YdQzTP8eWOcTo+nnGatM=zMA@mail.gmail.com>
	<CAFj8pRCE_Hv2cgq-3kwzdiDuL8rEsmvq6FKrZ7kkwpqfiXMm3Q@mail.gmail.com>
	<CA+hUKGLAyB0k4u_Rg9aoYg4+8BGuUY-UEz7vwxo3qOvm++NQKQ@mail.gmail.com>

Thomas Munro <thomas.munro@gmail.com> 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 queries, eg

regression=# select now() \watch
Tue Jul 13 13:44:44 2021 (every 2s)

              now              
-------------------------------
 2021-07-13 13:44:44.396565-04
(1 row)

Tue Jul 13 13:44:46 2021 (every 2s)

              now              
-------------------------------
 2021-07-13 13:44:46.396572-04
(1 row)

^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 position, messing up any editing I
might try to do on the next line of input.  So I think it would
be a good idea to have some explicit final output when the \watch
command terminates, along the line of

...
Tue Jul 13 13:44:46 2021 (every 2s)

              now              
-------------------------------
 2021-07-13 13:44:46.396572-04
(1 row)

^C\watch cancelled
regression=# 

This strikes me as a usability improvement even without the
readline-confusion angle.

			regards, tom lane





view thread (43+ messages)  latest in thread

Message-ID: <3278793.1626198638@sss.pgh.pa.us>
Permalink:  ../3278793.1626198638@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3278793.1626198638@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, thomas.munro@gmail.com, pavel.stehule@gmail.com, vignesh21@gmail.com
  Subject: Re: proposal - psql - use pager for \watch command
  In-Reply-To: <3278793.1626198638@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox