Обсуждение: psql output change in 9.4

Поиск
Список
Период
Сортировка

psql output change in 9.4

От
Peter Eisentraut
Дата:
This is 9.3:

peter=# \a
Output format is unaligned.
peter=# \a
Output format is aligned.
peter=# \x
Expanded display is on.
peter=# \x
Expanded display is off.

This is new in 9.4:

peter=# \a
Output format (format) is unaligned.
peter=# \a
Output format (format) is aligned.
peter=# \x
Expanded display (expanded) is on.
peter=# \x
Expanded display (expanded) is off.

What is the point of that change?

I suppose it is so that you can use \pset without arguments to show all
settings:

peter=# \pset
Border style (border) is 1.
Target width (columns) unset.
Expanded display (expanded) is off.
...

But those are unrelated features, and the changed output doesn't make
any sense in the contexts I show above.

I think this should be reverted, and the \pset output should be
implemented separately.





Re: psql output change in 9.4

От
Robert Haas
Дата:
On Fri, Aug 8, 2014 at 9:34 PM, Peter Eisentraut <peter_e@gmx.net> wrote:
> This is 9.3:
>
> peter=# \a
> Output format is unaligned.
> peter=# \a
> Output format is aligned.
> peter=# \x
> Expanded display is on.
> peter=# \x
> Expanded display is off.
>
> This is new in 9.4:
>
> peter=# \a
> Output format (format) is unaligned.
> peter=# \a
> Output format (format) is aligned.
> peter=# \x
> Expanded display (expanded) is on.
> peter=# \x
> Expanded display (expanded) is off.
>
> What is the point of that change?
>
> I suppose it is so that you can use \pset without arguments to show all
> settings:
>
> peter=# \pset
> Border style (border) is 1.
> Target width (columns) unset.
> Expanded display (expanded) is off.
> ...
>
> But those are unrelated features, and the changed output doesn't make
> any sense in the contexts I show above.
>
> I think this should be reverted, and the \pset output should be
> implemented separately.

Yes, the \pset patch (commit c64e68fd9f1132fec563fb5de53dc3bcccb5fc3b)
caused this behavior change.   I can't remember whether I noticed it
at the time and thought it was a reasonable change, or whether I
didn't notice it when committing.

Either way, clarifying the name of the parameter which is being
displayed does not seem like particularly bad idea to me even in the
contexts you mention.  I've certainly run commands like \a and \t and
then said to myself, "crap, which pset parameter does this correspond
to?".  And there was no easy way to figure it out.

I think the output could justly be criticized for making it
insufficiently clear that the parenthesized text is, in fact, the name
of the pset parameter.  We could write something like:

Border style (parameter "border") is 1.

But I don't know whether that would be considered an improvement or
just extra verbosity.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Re: psql output change in 9.4

От
Tom Lane
Дата:
Robert Haas <robertmhaas@gmail.com> writes:
> On Fri, Aug 8, 2014 at 9:34 PM, Peter Eisentraut <peter_e@gmx.net> wrote:
>> What is the point of that change?

> I think the output could justly be criticized for making it
> insufficiently clear that the parenthesized text is, in fact, the name
> of the pset parameter.

Quite; that wasn't apparent to me either.

> We could write something like:
> Border style (parameter "border") is 1.

How about

Border style (\pset border) is 1.
        regards, tom lane



Re: psql output change in 9.4

От
Pavel Stehule
Дата:



2014-08-11 19:52 GMT+02:00 Tom Lane <tgl@sss.pgh.pa.us>:
Robert Haas <robertmhaas@gmail.com> writes:
> On Fri, Aug 8, 2014 at 9:34 PM, Peter Eisentraut <peter_e@gmx.net> wrote:
>> What is the point of that change?

> I think the output could justly be criticized for making it
> insufficiently clear that the parenthesized text is, in fact, the name
> of the pset parameter.

Quite; that wasn't apparent to me either.

> We could write something like:
> Border style (parameter "border") is 1.

How about

Border style (\pset border) is 1.


+1

Pavel
 
                        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

Re: psql output change in 9.4

От
Robert Haas
Дата:
On Mon, Aug 11, 2014 at 1:52 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> On Fri, Aug 8, 2014 at 9:34 PM, Peter Eisentraut <peter_e@gmx.net> wrote:
>>> What is the point of that change?
>
>> I think the output could justly be criticized for making it
>> insufficiently clear that the parenthesized text is, in fact, the name
>> of the pset parameter.
>
> Quite; that wasn't apparent to me either.
>
>> We could write something like:
>> Border style (parameter "border") is 1.
>
> How about
>
> Border style (\pset border) is 1.

That would look just fine as a response to \a or \x, but I'm not sure
it would look as good as a response to \pset, which prints out that
line for every parameter ("why does every line say \pset when the
command I just typed is \pset?").  However, I can certainly live with
it if others prefer that to what I suggested.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Re: psql output change in 9.4

От
Bruce Momjian
Дата:
On Mon, Aug 11, 2014 at 02:28:45PM -0400, Robert Haas wrote:
> On Mon, Aug 11, 2014 at 1:52 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > Robert Haas <robertmhaas@gmail.com> writes:
> >> On Fri, Aug 8, 2014 at 9:34 PM, Peter Eisentraut <peter_e@gmx.net> wrote:
> >>> What is the point of that change?
> >
> >> I think the output could justly be criticized for making it
> >> insufficiently clear that the parenthesized text is, in fact, the name
> >> of the pset parameter.
> >
> > Quite; that wasn't apparent to me either.
> >
> >> We could write something like:
> >> Border style (parameter "border") is 1.
> >
> > How about
> >
> > Border style (\pset border) is 1.
>
> That would look just fine as a response to \a or \x, but I'm not sure
> it would look as good as a response to \pset, which prints out that
> line for every parameter ("why does every line say \pset when the
> command I just typed is \pset?").  However, I can certainly live with
> it if others prefer that to what I suggested.

I went with quoting the pset variable:

    test=> \a
    Output format ("format") is aligned.
    test=> \x
    Expanded display ("expanded") is on.

Patch attached.  I think this would be for 9.5 only, at this point.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +

Вложения

Re: psql output change in 9.4

От
Peter Eisentraut
Дата:
On 10/11/14 8:25 PM, Bruce Momjian wrote:
> On Mon, Aug 11, 2014 at 02:28:45PM -0400, Robert Haas wrote:
>> On Mon, Aug 11, 2014 at 1:52 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> Robert Haas <robertmhaas@gmail.com> writes:
>>>> On Fri, Aug 8, 2014 at 9:34 PM, Peter Eisentraut <peter_e@gmx.net> wrote:
>>>>> What is the point of that change?
>>>
>>>> I think the output could justly be criticized for making it
>>>> insufficiently clear that the parenthesized text is, in fact, the name
>>>> of the pset parameter.
>>>
>>> Quite; that wasn't apparent to me either.
>>>
>>>> We could write something like:
>>>> Border style (parameter "border") is 1.
>>>
>>> How about
>>>
>>> Border style (\pset border) is 1.
>>
>> That would look just fine as a response to \a or \x, but I'm not sure
>> it would look as good as a response to \pset, which prints out that
>> line for every parameter ("why does every line say \pset when the
>> command I just typed is \pset?").  However, I can certainly live with
>> it if others prefer that to what I suggested.
>
> I went with quoting the pset variable:
>
>     test=> \a
>     Output format ("format") is aligned.
>     test=> \x
>     Expanded display ("expanded") is on.
>
> Patch attached.  I think this would be for 9.5 only, at this point.

Funny, I was *just* working on that, too.  I propose a patch that
reverts the output to how it was in 9.3 (without anything in
parentheses), and implements the output of \pset without any arguments
separately, thus:

# \a
Output format is unaligned.

# \pset
border         2
columns        0
expanded       auto
fieldsep       '|'
fieldsep_zero  off
footer         on
format         unaligned
linestyle      unicode
null           ''
numericlocale  off
pager          1
recordsep      '\n'
recordsep_zero off
tableattr
title
tuples_only    off

(This is also symmetric with what \set outputs.)

On closer examination, the change in 9.4, besides having the aesthetic
issues discussed earlier, also created some outright incorrect output by
mixing together fieldsep/fieldsep_zero and recordsep/recordsep_zero.
These issues become much clearer if you separate the case of "this is
what you just set" from "these are all the current settings".


Вложения

Re: psql output change in 9.4

От
Bruce Momjian
Дата:
On Sun, Oct 12, 2014 at 12:17:31AM -0400, Peter Eisentraut wrote:
> > I went with quoting the pset variable:
> > 
> >     test=> \a
> >     Output format ("format") is aligned.
> >     test=> \x
> >     Expanded display ("expanded") is on.
> > 
> > Patch attached.  I think this would be for 9.5 only, at this point.
> 
> Funny, I was *just* working on that, too.  I propose a patch that
> reverts the output to how it was in 9.3 (without anything in
> parentheses), and implements the output of \pset without any arguments
> separately, thus:
> 
> # \a
> Output format is unaligned.

Agreed.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + Everyone has their own god. +



Re: psql output change in 9.4

От
Tom Lane
Дата:
Bruce Momjian <bruce@momjian.us> writes:
> On Sun, Oct 12, 2014 at 12:17:31AM -0400, Peter Eisentraut wrote:
>>> Patch attached.  I think this would be for 9.5 only, at this point.

>> Funny, I was *just* working on that, too.  I propose a patch that
>> reverts the output to how it was in 9.3 (without anything in
>> parentheses), and implements the output of \pset without any arguments
>> separately, thus:

> Agreed.

Works for me, too.  If we are reverting to 9.3's output in the base case,
I think this *does* need to get back-patched into 9.4.
        regards, tom lane