Re: Request - repeat value of \pset title during \watch interations

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Request - repeat value of \pset title during \watch interations
Date: 2016-01-28 00:34:24
Message-ID: CAKFQuwYTggSzqt7tth7pWKO6o9JfuQdxT4LGexJ0JEqr+Y5cjQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Mon, Jan 11, 2016 at 9:55 PM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
wrote:

> On Tue, Jan 12, 2016 at 1:15 AM, David G. Johnston
> <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> > On Mon, Jan 11, 2016 at 9:03 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >>
> >> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> >> > On Mon, Jan 11, 2016 at 8:14 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >> >> Perhaps we should replace the "Watch every Ns" text by the user-given
> >> >> title if a title has been set? That would conserve screen space.
> >>
> >> > The extra line doesn't both me and given the length of the timestamp I
> >> > suspect many titles would cause the combined line length to exceed
> >> > terminal
> >> > width and cause wrapping anyway. In my specific case it would though
> I
> >> > am
> >> > using an abnormally narrow width.
> >>
> >> You speak as though the title will be chosen without any regard for the
> >> context it's used in, which I rather doubt. Wouldn't people pick the
> >> title for a \watch query so that it fits? (In any case they could
> >> force the issue by including a \n in their title...)
> >>
> >
> > True that.
> >
> > I don't have a strong opinion either way. Having a single, condensed,
> title
> > line would be nice though using two in order to not be cryptic has its
> own
> > appeal.
>
> Just looking at that I just hacked the attached that enforces \n at
> the end of the user-defined title (that's easily changeable):
> =# \pset title 'foo bar'
> Title is "foo bar".
> =# select 1;
> foo bar
> ?column?
> ----------
> 1
> (1 row)
> =# \watch 1
> foo bar
> Watch every 1s Tue Jan 12 13:54:04 2016
>
> ?column?
> ----------
> 1
> (1 row)
> --
> Michael
>

​On the code side calling it "caption" would make for less confusing
reading since "title" is already defined and "head_title" just doesn't
distinguish enough.

There doesn't seem to be any way to let the user decide - by adding a
newline to the end them-self - so a decision will have to be reached.

So how about:

+ snprintf(title, strlen(myopt.title) + 50,
+ _("Watch every %lds\t%s\t%s"),
+ sleep, head_title, asctime(localtime(&timer)));

David J

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Berend Tober 2016-01-28 02:00:00 Re: Multi-Table Insert/Update Strategy - Use Functions/Procedures?
Previous Message Don Parris 2016-01-28 00:26:52 Re: Multi-Table Insert/Update Strategy - Use Functions/Procedures?

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2016-01-28 01:05:14 Re: [PoC] Asynchronous execution again (which is not parallel)
Previous Message Kouhei Kaigai 2016-01-28 00:33:26 Re: CustomScan under the Gather node?