Thread: SHOW ALL output too wide

SHOW ALL output too wide

From
Dennis Bjorklund
Date:
I've noticed that in 8.1 the output of SHOW ALL includes a description
column. This makes the output very wide which makes it hard to use from
psql (I need to make the terminal window 164 characters wide to not get
any line wrapping). I wish I would have noticed this before 8.0 was out 
and then I would have voted no.

Also, how come it's not implemented by a \show command in psql that
queries pg_settings. Then it would work like most other commands. And one
could have a \show+ command that include the description.

Actually, I'm going to implement a \show command and send to -patches and
then SHOW can even be deprecated (if we want). SHOW is just a command line
client command, that is implemented in the server. That is not how we
normally do things in pg (for example, we have \d instead of a server
DESCRIBE command).

-- 
/Dennis Björklund



Re: SHOW ALL output too wide

From
Bruce Momjian
Date:
Dennis Bjorklund wrote:
> I've noticed that in 8.1 the output of SHOW ALL includes a description
> column. This makes the output very wide which makes it hard to use from
> psql (I need to make the terminal window 164 characters wide to not get
> any line wrapping). I wish I would have noticed this before 8.0 was out 
> and then I would have voted no.
> 
> Also, how come it's not implemented by a \show command in psql that
> queries pg_settings. Then it would work like most other commands. And one
> could have a \show+ command that include the description.

Why implement something in the client if the server supports it cleanly
already.

Try \x to see the output clearer.

> 
> Actually, I'm going to implement a \show command and send to -patches and
> then SHOW can even be deprecated (if we want). SHOW is just a command line
> client command, that is implemented in the server. That is not how we
> normally do things in pg (for example, we have \d instead of a server
> DESCRIBE command).

If you remove SHOW then applications/interfaces can't use it, which is
bad.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: SHOW ALL output too wide

From
Alvaro Herrera
Date:
Bruce Momjian wrote:
> Dennis Bjorklund wrote:

> > Actually, I'm going to implement a \show command and send to -patches and
> > then SHOW can even be deprecated (if we want). SHOW is just a command line
> > client command, that is implemented in the server. That is not how we
> > normally do things in pg (for example, we have \d instead of a server
> > DESCRIBE command).
> 
> If you remove SHOW then applications/interfaces can't use it, which is
> bad.

I think a \show would be nice, but deprecating SHOW is out of the
question.  (The pg_settings view is a perfect replacement AFAICS but I
doubt we can get rid of the old interface.)

OTOH, what's the relationship between \show and Martijn's wide output
patch?  Maybe the problem can be solved in a different way.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


Re: SHOW ALL output too wide

From
Martijn van Oosterhout
Date:
On Fri, Nov 25, 2005 at 07:24:13PM -0300, Alvaro Herrera wrote:
> OTOH, what's the relationship between \show and Martijn's wide output
> patch?  Maybe the problem can be solved in a different way.

None whatsoever. OTOH, there has been discussion about making use of
multiline output if it can be displayed sensibly by psql. Right now
it's undergoing some revision related to encodings but at some point it
may be a useful discussion to have.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Re: SHOW ALL output too wide

From
Bruce Momjian
Date:
Alvaro Herrera wrote:
> Bruce Momjian wrote:
> > Dennis Bjorklund wrote:
> 
> > > Actually, I'm going to implement a \show command and send to -patches and
> > > then SHOW can even be deprecated (if we want). SHOW is just a command line
> > > client command, that is implemented in the server. That is not how we
> > > normally do things in pg (for example, we have \d instead of a server
> > > DESCRIBE command).
> > 
> > If you remove SHOW then applications/interfaces can't use it, which is
> > bad.
> 
> I think a \show would be nice, but deprecating SHOW is out of the
> question.  (The pg_settings view is a perfect replacement AFAICS but I
> doubt we can get rid of the old interface.)
> 
> OTOH, what's the relationship between \show and Martijn's wide output
> patch?  Maybe the problem can be solved in a different way.

What does \show do that SHOW does not?

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: SHOW ALL output too wide

From
Dennis Bjorklund
Date:
On Fri, 25 Nov 2005, Bruce Momjian wrote:

> > OTOH, what's the relationship between \show and Martijn's wide output
> > patch?  Maybe the problem can be solved in a different way.
> 
> What does \show do that SHOW does not?

It could do several things. For example \show could omit the description 
column and \show+ can include it. One could let \show support a pattern 
just like we do for table names in \d.

Other then that I don't know right now what it would do. Maybe if you show 
a single variable it could show the maximum and minimum value if such 
exist.

My main problem with SHOW as it is in 8.1 is that the output is so wide 
that it's very hard to read the output.

Is there any use for SHOW except in interactive psql sessions?

-- 
/Dennis Björklund



Re: SHOW ALL output too wide

From
Alvaro Herrera
Date:
Bruce Momjian wrote:
> Alvaro Herrera wrote:
> > Bruce Momjian wrote:
> > > Dennis Bjorklund wrote:
> > 
> > > > Actually, I'm going to implement a \show command and send to -patches and
> > > > then SHOW can even be deprecated (if we want). SHOW is just a command line
> > > > client command, that is implemented in the server. That is not how we
> > > > normally do things in pg (for example, we have \d instead of a server
> > > > DESCRIBE command).
> > > 
> > > If you remove SHOW then applications/interfaces can't use it, which is
> > > bad.
> > 
> > I think a \show would be nice, but deprecating SHOW is out of the
> > question.  (The pg_settings view is a perfect replacement AFAICS but I
> > doubt we can get rid of the old interface.)
> > 
> > OTOH, what's the relationship between \show and Martijn's wide output
> > patch?  Maybe the problem can be solved in a different way.
> 
> What does \show do that SHOW does not?

Well, nothing given that it isn't implemented yet :-)  But if I
understood Dennis' proposal, the idea was that the output would be
nicely formatted instead of wrapping.

(I just noticed that Martijn's patch is not about auto-wrapping but
about displaying \n correctly, which is quite different.  So while there
may be some common code it certainly is not the same thing.)

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


Re: SHOW ALL output too wide

From
Alvaro Herrera
Date:
Dennis Bjorklund wrote:

> My main problem with SHOW as it is in 8.1 is that the output is so wide 
> that it's very hard to read the output.
> 
> Is there any use for SHOW except in interactive psql sessions?

Nothing that can't be done by querying pg_settings.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


Re: SHOW ALL output too wide

From
Bruce Momjian
Date:
Alvaro Herrera wrote:
> > > I think a \show would be nice, but deprecating SHOW is out of the
> > > question.  (The pg_settings view is a perfect replacement AFAICS but I
> > > doubt we can get rid of the old interface.)
> > > 
> > > OTOH, what's the relationship between \show and Martijn's wide output
> > > patch?  Maybe the problem can be solved in a different way.
> > 
> > What does \show do that SHOW does not?
> 
> Well, nothing given that it isn't implemented yet :-)  But if I
> understood Dennis' proposal, the idea was that the output would be
> nicely formatted instead of wrapping.

Well, that's hardly a reason to add something to the client that is
already in the backend.  A much more general solution would be to either
add a flag to SHOW ALL to supress the extra column (or one to add it),
or auto-\x for wide output.  Hacking in \show is not the solution. 
There was a long discussion about outputing the description for SHOW. 
Originally SHOW always showed the description, but the agreed behavior
was that only SHOW ALL would show it.

> (I just noticed that Martijn's patch is not about auto-wrapping but
> about displaying \n correctly, which is quite different.  So while there
> may be some common code it certainly is not the same thing.)

Right.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: SHOW ALL output too wide

From
Bruce Momjian
Date:
Alvaro Herrera wrote:
> Dennis Bjorklund wrote:
> 
> > My main problem with SHOW as it is in 8.1 is that the output is so wide 
> > that it's very hard to read the output.
> > 
> > Is there any use for SHOW except in interactive psql sessions?

There certainly is.  Imagine querying for timezone.  Also remember that
pgadmin is a client application that is _not_ psql.

> Nothing that can't be done by querying pg_settings.

True, so we have pg_settings and SHOW.  I see no reason for a third,
\show.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: SHOW ALL output too wide

From
Dennis Bjorklund
Date:
On Fri, 25 Nov 2005, Bruce Momjian wrote:

> > > Is there any use for SHOW except in interactive psql sessions?
> 
> There certainly is.  Imagine querying for timezone.  Also remember that
> pgadmin is a client application that is _not_ psql.

I should have written SHOW ALL, that's the command output that is too wide
to fit in a normal terminal window. Do pgadmin use SHOW ALL?

I would expect pgadmin to query pg_settings so that it get all info about
the variable that is stored and show it in the gui in some way. But I
don't use pgadmin so I don't know how it show the list of server
variables.

SHOW ALL really is an interactive command line interface command that is
implemented by the server.

> > Nothing that can't be done by querying pg_settings.
> 
> True, so we have pg_settings and SHOW.  I see no reason for a third,
> \show.

The same can be said about all slash-commands in psql.

By the way, we have yet another way. We have the functions that fetch 
server variable settings, like pg_show_all_settings().

Is your suggestion that we keep SHOW ALL as is? Or is that we extend it to
something like SHOW ALL NO DESC?

If we keep it as is then I would like to ask who is the target user it's
designed for? It's probably not for psql users since the output isn't
readable by anyone but those that have terminal windows > 165 characters
wide. It can't be for computer clients since those don't need the 
description column. So who is it designed for?

-- 
/Dennis Björklund



Re: SHOW ALL output too wide

From
Martijn van Oosterhout
Date:
On Fri, Nov 25, 2005 at 08:25:55PM -0300, Alvaro Herrera wrote:
> (I just noticed that Martijn's patch is not about auto-wrapping but
> about displaying \n correctly, which is quite different.  So while there
> may be some common code it certainly is not the same thing.)

Auto-wrapping has been considered and wouldn't even be too hard to do,
if one could decide where to wrap. With only three columns it would be
fairly easy to decide that the one that take more than half the screen
should be wrapped.

But say you have five integer columns and 6 text columns, when do you
wrap? I've been thinking it might be easiest to be able to say "wrap
any column wider than <variable>". Setting that to half the screen
width would probably work well in most situations...

Have a nice day.
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Re: SHOW ALL output too wide

From
Bruce Momjian
Date:
Dennis Bjorklund wrote:
> On Fri, 25 Nov 2005, Bruce Momjian wrote:
> 
> > > > Is there any use for SHOW except in interactive psql sessions?
> > 
> > There certainly is.  Imagine querying for timezone.  Also remember that
> > pgadmin is a client application that is _not_ psql.
> 
> I should have written SHOW ALL, that's the command output that is too wide
> to fit in a normal terminal window. Do pgadmin use SHOW ALL?

No idea, but it doesn't matter.  We have no way of knowing what
interfaces use which commands.

> I would expect pgadmin to query pg_settings so that it get all info about
> the variable that is stored and show it in the gui in some way. But I
> don't use pgadmin so I don't know how it show the list of server
> variables.

The project goal is not to make everyone happy with every behavior, but
rather choose defaults that are acceptable to the majority of people. 
If people want to modify their local copy of PostgreSQL, they are
welcome to do so.

> SHOW ALL really is an interactive command line interface command that is
> implemented by the server.

Well, many have complained that the psql backslash commands should
rather be in the backend, and the information schema has added that.

> > > Nothing that can't be done by querying pg_settings.
> > 
> > True, so we have pg_settings and SHOW.  I see no reason for a third,
> > \show.
> 
> The same can be said about all slash-commands in psql.

Right, see above.  Moving more into the client seems like the wrong
direction.

> By the way, we have yet another way. We have the functions that fetch 
> server variable settings, like pg_show_all_settings().

OK.

> Is your suggestion that we keep SHOW ALL as is? Or is that we extend it to
> something like SHOW ALL NO DESC?

NO DESC is just too ugly, especially since DESC is short for DESCENDING
in the standard.  I originally suggested VERBOSE, but no one replied,
and I thought it might be overkill.  Using that system, SHOW and SHOW
ALL would not show descriptions, but SHOW VERBOSE [ALL] would.

> If we keep it as is then I would like to ask who is the target user it's
> designed for? It's probably not for psql users since the output isn't
> readable by anyone but those that have terminal windows > 165 characters
> wide. It can't be for computer clients since those don't need the 
> description column. So who is it designed for?

See the discussion or really solo request by me for more feedback when
this change was made for 8.1:
http://archives.postgresql.org/pgsql-patches/2005-06/msg00295.php

Where were you when I asked?  Didn't you notice it in the release notes
that have been online for months?
    * Make "SHOW ALL" include variable descriptions (Matthias Schmidt)

It is unlikely this will be changed in any 8.1.X release. If you want it
modified for 8.2, we will need to see more than one person complaining
about it, because until now no one has complained about the documented
8.1 change. If you can find a sufficient number of people who like the
VERBOSE idea, we can make this modification for 8.2.  In the mean time,
you can use a psql \set macro to run a query that pulls the fields from
pg_settings.
\set show 'select name, setting from pg_settings;'

and call it with :show.  Same number of characters as '\show'.  :-)

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: SHOW ALL output too wide

From
"Greg Sabino Mullane"
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> Well, that's hardly a reason to add something to the client that is
> already in the backend.  A much more general solution would be to either
> add a flag to SHOW ALL to supress the extra column (or one to add it),

An even more general solution is to use the features already built-in to
psql. Specifically, you can use a pager (e.g. "less" on unixy systems)
that supports horizontal scrolling, plus \pset pager always, thus fixing
the problem, regardless of what your terminal settings are.

- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200511261111
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8

-----BEGIN PGP SIGNATURE-----

iD8DBQFDiIlyvJuQZxSWSsgRAlp0AJ0RvLfiHyTFRkech+PZt0HX+KFRkQCgs9q9
YWUyinfWfEvgCuj08kZfmMY=
=CMBv
-----END PGP SIGNATURE-----




Re: SHOW ALL output too wide

From
Dennis Bjorklund
Date:
On Sat, 26 Nov 2005, Bruce Momjian wrote:

> See the discussion or really solo request by me for more feedback when
> this change was made for 8.1:
> 
>     http://archives.postgresql.org/pgsql-patches/2005-06/msg00295.php
> 
> Where were you when I asked?

I do not work with postgresql like you do and can't follow everything,
that's just how life is. I've not used 8.1 much until recently, and that's
when I noticed the new behaviour.

I spend about 10 hours per week helping the pg project, mostly by giving
support in the #postgresql irc channel. That's about all the time I am
prepared to give. The main use I have of the SHOW ALL command it to tell
people to run it to show me what settings they have.

> Didn't you notice it in the release notes that have been online for
> months?
> 
>      * Make "SHOW ALL" include variable descriptions (Matthias Schmidt)

And you except me to understand from that line that the output from SHOW 
ALL is much harder for me to read now then it was before?

I brought it up as soon as I knew about it. I don't think it's fair of you
to demand that I keep my mouth shut just because I can't follow the
development of pg as close as you can. But of course, if someone wants to 
pay my for working full time on pg I would be very happy :-)

> It is unlikely this will be changed in any 8.1.X release. If you want it
> modified for 8.2, we will need to see more than one person complaining
> about it, because until now no one has complained about the documented
> 8.1 change.

Then I hope that when people notice it they will also speak up (if they
dare to do so now given that they missed the discussion you speak of
above).

I agree that for 8.1.x we only want bug fixes (as always, unless there are
very, very many complaints).

> If you can find a sufficient number of people who like the VERBOSE idea

I don't like the verbose idea. I think commands like that don't belong in
the server at all. Different clients have different needs. For example I
prefer that the \d command is implemented by psql and not by a DESCRIBE
command. I don't want a lot of different server commands that present
things in different ways for different clients. SHOW need to stay because 
there have always been a SHOW command, but do we really want to build in 
more things like that?

What I would want is one of:
* Revert to the old SHOW ALL command
* Implement a \show in psql that can do more then a server command  if we want it to.

My motivation is only for the good of postgresql. If the majority want
something else then that's what should happen (of course). I'm just 
stating my view, nothing less and nothing more.

-- 
/Dennis Björklund



Re: SHOW ALL output too wide

From
Bruce Momjian
Date:
Dennis Bjorklund wrote:
> My motivation is only for the good of postgresql. If the majority want
> something else then that's what should happen (of course). I'm just 
> stating my view, nothing less and nothing more.

I am surprised we have not gotten more comments about it.  I personally
like the VERBOSE idea myself, but others didn't, so what we have now was
the consensus.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: SHOW ALL output too wide

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Dennis Bjorklund wrote:
>> My motivation is only for the good of postgresql. If the majority want
>> something else then that's what should happen (of course). I'm just 
>> stating my view, nothing less and nothing more.

> I am surprised we have not gotten more comments about it.  I personally
> like the VERBOSE idea myself, but others didn't, so what we have now was
> the consensus.

Personally I'd vote for losing the description, ie, revert SHOW ALL to
the way it was in 8.0 (and never mind the VERBOSE option, either).
I don't find the descriptions to be a helpful addition.
        regards, tom lane


Re: SHOW ALL output too wide

From
Bruce Momjian
Date:
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Dennis Bjorklund wrote:
> >> My motivation is only for the good of postgresql. If the majority want
> >> something else then that's what should happen (of course). I'm just 
> >> stating my view, nothing less and nothing more.
> 
> > I am surprised we have not gotten more comments about it.  I personally
> > like the VERBOSE idea myself, but others didn't, so what we have now was
> > the consensus.
> 
> Personally I'd vote for losing the description, ie, revert SHOW ALL to
> the way it was in 8.0 (and never mind the VERBOSE option, either).
> I don't find the descriptions to be a helpful addition.

The big question is whether general users will find the descriptions
helpful.  I thought the agreement that they were, similar to how we have
psql \h help.  It doesn't replace the documentation, but it does assist.

In fact, if we don't show the descriptions, why are we maintaining them? 
Just for "SELECT * FROM pg_settings"?

I do think we have divergent opinions on this and that is why our
default now is so inconsistent.  Can we get more comments from users?

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073