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 16:55:33
Message-ID: CAKFQuwaAS4tz3A7tSJf+i6XO5zm3AL56q-QdXcXLrpM=zad93g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Thu, Jan 28, 2016 at 6:01 AM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
wrote:

> On Thu, Jan 28, 2016 at 1:54 PM, David G. Johnston
> <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> > On Wed, Jan 27, 2016 at 9:13 PM, Michael Paquier <
> michael(dot)paquier(at)gmail(dot)com>
> > wrote:
> >>
> >> On Thu, Jan 28, 2016 at 9:34 AM, David G. Johnston
> >> <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> >> > So how about:
> >> >
> >> > + snprintf(title, strlen(myopt.title) + 50,
> >> > + _("Watch every %lds\t%s\t%s"),
> >> > + sleep, head_title, asctime(localtime(&timer)));
> >>
> >> I would just keep the timestamp and the title separated so what do you
> >> think about that instead?
> >> Watch every Xs $timestamp
> >> $head_title
> >
> >
> > That works. I like having the title immediately above the table.
> >
> > The other option that came to mind would be to place the time information
> > after the table display while leaving the title before it. On an output
> > that requires more vertical space than is available in the terminal one
> > would no longer have to scroll up to confirm last execution time. If
> doing
> > this I'd probably get rid of any logic that attempts to center the time
> > information on the table and simply leave it left-aligned.
>
> OK, attached is an updated patch. How does that look?
>
>
Could you run the following and post the result, please? I have yet to
setup a compiled-from-source installation...

\pset title 'This is a medium length title'
SELECT repeat('a', 100) \watch 5

It seems fine though I'm curious how it plays with various combinations of
narrow and wide outputs on narrow and wide terminals - specifically the
centering​

​aspect that occurs when the table is wider than the Watch/Time content.
The terminal width should just cause wrapping relative to a wide-enough
terminal so really it just the centering aspect when the table is wider
than the header.

​Thanks!

David J.​

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kaushal Shriyan 2016-01-28 17:03:26 Re: Difference between UDR and BDR replication
Previous Message Artur Zakirov 2016-01-28 16:34:46 Re: Using a german affix file for compound words

Browse pgsql-hackers by date

  From Date Subject
Next Message Thom Brown 2016-01-28 17:03:02 Re: [WIP] Effective storage of duplicates in B-tree index.
Previous Message David G. Johnston 2016-01-28 16:43:31 Re: Set search_path + server-prepared statements = cached plan must not change result type