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

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Request - repeat value of \pset title during \watch interations
Дата
Msg-id CAKFQuwb1MA0EPDsUJ-rmEcnyWpxo2VzkXLLTNa2_3REvnofWkQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Request - repeat value of \pset title during \watch interations  (Michael Paquier <michael.paquier@gmail.com>)
Ответы Re: Request - repeat value of \pset title during \watch interations  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: [HACKERS] Request - repeat value of \pset title during \watch interations  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-general
Adding -hackers for consideration in the Commitfest.

Thanks!

David J.

>>>Original request by me


When executing a query using \watch in psql the first execution of the query includes "Title is [...]" when \pset title is in use.  Subsequent executions do not.  Once that first display goes off-screen the information in the title is no longer readily accessible.  If using \watch for a long-running monitoring query it can be helpful to incorporate some context information into the title.

---------- Forwarded message ----------
From: Michael Paquier <michael.paquier@gmail.com>
Date: Thu, Jan 28, 2016 at 6:01 AM
Subject: Re: [GENERAL] Request - repeat value of \pset title during \watch interations
To: "David G. Johnston" <david.g.johnston@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, "pgsql-general@postgresql.org" <pgsql-general@postgresql.org>


On Thu, Jan 28, 2016 at 1:54 PM, David G. Johnston
<david.g.johnston@gmail.com> wrote:
> On Wed, Jan 27, 2016 at 9:13 PM, Michael Paquier <michael.paquier@gmail.com>
> wrote:
>>
>> On Thu, Jan 28, 2016 at 9:34 AM, David G. Johnston
>> <david.g.johnston@gmail.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.

​And the example:
OK, attached is an updated patch. How does that look?

                               Watch every 5s    Fri Jan 29 13:06:31 2016

This is a medium length title
                                                repeat                                               
------------------------------------------------------------------------------------------------------
 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
(1 row)


Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Plan to support predicate push-down into subqueries with aggregates?
Следующее
От: Condor
Дата:
Сообщение: Unable to match same value in field.