Request - repeat value of \pset title during \watch interations
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.
Does anyone capable agree enough to implement this?
Any suggestions for a better way to accomplish the goal?
I have a watch query whose title incorporates the name of the libpq service
name (via bash variables on Linux) so that I can verify which database it
is monitoring without having to kill the watched command and inspect the
prompt, command line, or process.
Working with 9.3 presently.
Thanks!
David J.
On Mon, Jan 11, 2016 at 3:36 AM, David G. Johnston
<david.g.johnston@gmail.com> wrote:
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.
Yeah, this sounds like a good idea to show it at each iteration if the
title is set. I am not sure we would want to treat that as a bug fix
as nothing is broken, it looks more like a new feature.
Any suggestions for a better way to accomplish the goal?
What I have been doing in such cases until now is updating the name of
the terminal tab to identify what was going on.
--
Michael
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Michael Paquier <michael.paquier@gmail.com> writes:
On Mon, Jan 11, 2016 at 3:36 AM, David G. Johnston
<david.g.johnston@gmail.com> wrote: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.
Yeah, this sounds like a good idea to show it at each iteration if the
title is set.
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.
regards, tom lane
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
On Mon, Jan 11, 2016 at 8:14 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Michael Paquier <michael.paquier@gmail.com> writes:
On Mon, Jan 11, 2016 at 3:36 AM, David G. Johnston
<david.g.johnston@gmail.com> wrote: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 along-running
monitoring query it can be helpful to incorporate some context
information
into the title.
Yeah, this sounds like a good idea to show it at each iteration if the
title is set.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.
David J.
On Mon, Jan 11, 2016 at 4:14 AM, Michael Paquier <michael.paquier@gmail.com>
wrote:
On Mon, Jan 11, 2016 at 3:36 AM, David G. Johnston
<david.g.johnston@gmail.com> wrote: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 along-running
monitoring query it can be helpful to incorporate some context
information
into the title.
Yeah, this sounds like a good idea to show it at each iteration if the
title is set. I am not sure we would want to treat that as a bug fix
as nothing is broken, it looks more like a new feature.
I would agree...but wouldn't personally argue against the bug-fix
interpretation. Given the nature of watch, that it is used for human
interaction, the odds of it being used in an automation environment - where
a change in layout could have an impact - it highly unlikely.
Any suggestions for a better way to accomplish the goal?
What I have been doing in such cases until now is updating the name of
the terminal tab to identify what was going on.
Except I run my two monitor queries inside a tmux pane and so cannot
directly give them names. I get the point and probably a window name would
end up being sufficient.
David J.
"David G. Johnston" <david.g.johnston@gmail.com> writes:
On Mon, Jan 11, 2016 at 8:14 AM, Tom Lane <tgl@sss.pgh.pa.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...)
regards, tom lane
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
On Mon, Jan 11, 2016 at 9:03 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
"David G. Johnston" <david.g.johnston@gmail.com> writes:
On Mon, Jan 11, 2016 at 8:14 AM, Tom Lane <tgl@sss.pgh.pa.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 exceedterminal
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.
David J.
On Tue, Jan 12, 2016 at 1:15 AM, David G. Johnston
<david.g.johnston@gmail.com> wrote:
On Mon, Jan 11, 2016 at 9:03 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
"David G. Johnston" <david.g.johnston@gmail.com> writes:
On Mon, Jan 11, 2016 at 8:14 AM, Tom Lane <tgl@sss.pgh.pa.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
Attachments:
psql_watch_title.patchapplication/x-patch; name=psql_watch_title.patchDownload+27-3
On Mon, Jan 11, 2016 at 9:55 PM, Michael Paquier <michael.paquier@gmail.com>
wrote:
On Tue, Jan 12, 2016 at 1:15 AM, David G. Johnston
<david.g.johnston@gmail.com> wrote:On Mon, Jan 11, 2016 at 9:03 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
"David G. Johnston" <david.g.johnston@gmail.com> writes:
On Mon, Jan 11, 2016 at 8:14 AM, Tom Lane <tgl@sss.pgh.pa.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 thoughI
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
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
--
Michael
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
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.
David J.
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_titleThat 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?
--
Michael
Attachments:
psql_watch_title-v2.patchtext/x-diff; charset=US-ASCII; name=psql_watch_title-v2.patchDownload+27-3
On Thu, Jan 28, 2016 at 6:01 AM, Michael Paquier <michael.paquier@gmail.com>
wrote:
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_titleThat 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. Ifdoing
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.
On Fri, Jan 29, 2016 at 1:55 AM, David G. Johnston wrote:
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 5It seems fine though I'm curious how it plays with various combinations of
narrow and wide outputs on narrow and wide terminals - specifically the
centeringaspect 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.
No problem. Here you go:
Watch every 5s Fri Jan 29 13:06:31 2016
This is a medium length title
repeat
------------------------------------------------------------------------------------------------------
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
(1 row)
--
Michael
On Thu, Jan 28, 2016 at 9:07 PM, Michael Paquier <michael.paquier@gmail.com>
wrote:
On Fri, Jan 29, 2016 at 1:55 AM, David G. Johnston wrote:
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 5It seems fine though I'm curious how it plays with various combinations
of
narrow and wide outputs on narrow and wide terminals - specifically the
centeringaspect 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.No problem. Here you go:
Watch every 5s Fri Jan 29 13:06:31 2016
This is a medium length title
repeat------------------------------------------------------------------------------------------------------
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
(1 row)
--
Michael
Looks good to me.
Thank You!
David J.
Adding -hackers for consideration in the Commitfest.
Thanks!
David J.
Original request by me
/messages/by-id/CAKFQuwZqjz-je3Z=8JDOdYm3JM-N2UL4cuqy5VH8N75E5v1VVQ@mail.gmail.com
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_titleThat 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
------------------------------------------------------------
------------------------------------------
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
(1 row)
Attachments:
psql_watch_title-v2.patchtext/x-diff; charset=US-ASCII; name=psql_watch_title-v2.patchDownload+27-3
Figured out it had to be added to 2016-09...done
On Wed, Mar 9, 2016 at 11:40 PM, David G. Johnston <
david.g.johnston@gmail.com> wrote:
Show quoted text
Adding -hackers for consideration in the Commitfest.
Thanks!
David J.
Original request by me
/messages/by-id/CAKFQuwZqjz-je3Z=8JDOdYm3JM-N2UL4cuqy5VH8N75E5v1VVQ@mail.gmail.com
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_titleThat 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. Ifdoing
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------------------------------------------------------------
------------------------------------------
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
(1 row)
On 3/17/16 5:07 PM, David G. Johnston wrote:
Figured out it had to be added to 2016-09...done
Hmm ... this patch is currently marked "needs review" in CF 2016-03. Am
I missing something, should this have been closed?
--
-David
david@pgmasters.net
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
David Steele <david@pgmasters.net> writes:
On 3/17/16 5:07 PM, David G. Johnston wrote:
Figured out it had to be added to 2016-09...done
Hmm ... this patch is currently marked "needs review" in CF 2016-03. Am
I missing something, should this have been closed?
The message I saw was post-1-March. If it was in fact submitted in
time for 2016-03, then we owe it a review.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 3/17/16 7:00 PM, Tom Lane wrote:
David Steele <david@pgmasters.net> writes:
On 3/17/16 5:07 PM, David G. Johnston wrote:
Figured out it had to be added to 2016-09...done
Hmm ... this patch is currently marked "needs review" in CF 2016-03. Am
I missing something, should this have been closed?The message I saw was post-1-March. If it was in fact submitted in
time for 2016-03, then we owe it a review.
I meant to add the CF record and forgot:
https://commitfest.postgresql.org/9/480
It was added 2016-01-13 by Michael Paquier.
--
-David
david@pgmasters.net
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general