Re: psql output change in 9.4

Lists: pgsql-hackers
From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: psql output change in 9.4
Date: 2014-08-09 01:34:22
Message-ID: 1407548062.13736.7.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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.


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql output change in 9.4
Date: 2014-08-11 17:46:07
Message-ID: CA+Tgmob5K=N3PjCCMYWvXaAMJi45ZDnRcfAdaq=fsgmsLWdVWg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Aug 8, 2014 at 9:34 PM, Peter Eisentraut <peter_e(at)gmx(dot)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


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql output change in 9.4
Date: 2014-08-11 17:52:59
Message-ID: 25860.1407779579@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Fri, Aug 8, 2014 at 9:34 PM, Peter Eisentraut <peter_e(at)gmx(dot)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


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql output change in 9.4
Date: 2014-08-11 18:22:46
Message-ID: CAFj8pRB8dNR+oyniMTx1zLfEjvoUW-EijKL4Qh35fKzwpEPzOw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2014-08-11 19:52 GMT+02:00 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:

> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> > On Fri, Aug 8, 2014 at 9:34 PM, Peter Eisentraut <peter_e(at)gmx(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql output change in 9.4
Date: 2014-08-11 18:28:45
Message-ID: CA+TgmoYTj2zWoC=aSQFDKGsCi2gfezfdhkakxtzXEt85vUnJ+w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Aug 11, 2014 at 1:52 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Fri, Aug 8, 2014 at 9:34 PM, Peter Eisentraut <peter_e(at)gmx(dot)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


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql output change in 9.4
Date: 2014-10-12 00:25:32
Message-ID: 20141012002532.GQ21267@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> >> On Fri, Aug 8, 2014 at 9:34 PM, Peter Eisentraut <peter_e(at)gmx(dot)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(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

Attachment Content-Type Size
psql.diff text/x-diff 6.3 KB

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Bruce Momjian <bruce(at)momjian(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql output change in 9.4
Date: 2014-10-12 04:17:31
Message-ID: 543A00DB.7060100@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>>>> On Fri, Aug 8, 2014 at 9:34 PM, Peter Eisentraut <peter_e(at)gmx(dot)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".

Attachment Content-Type Size
pset.patch text/x-patch 10.1 KB

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql output change in 9.4
Date: 2014-10-13 15:10:09
Message-ID: 20141013151009.GV21267@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql output change in 9.4
Date: 2014-10-13 15:13:55
Message-ID: 798.1413213235@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian <bruce(at)momjian(dot)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