Re: One-shot expanded output in psql using \G

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Christoph Berg <christoph(dot)berg(at)credativ(dot)de>, Daniel Verite <daniel(at)manitou-mail(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: One-shot expanded output in psql using \G
Date: 2017-01-30 15:52:36
Message-ID: CAKFQuwbrrKkkyN=5MRVW_ydf9SF5aC2XAO-+0zeubkSiQPwc9w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 30, 2017 at 8:35 AM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:

> Tom,
>
> * Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
> > Stephen Frost <sfrost(at)snowman(dot)net> writes:
> > > This particular bike-shedding really doesn't seem to be terribly useful
> > > or sensible, to me. \gx isn't "consistent" or "descriptive", frankly.
> >
> > Why not? To me it reads as "\g with an x option". The "x" refers to
> > the implied "\x", so it's not an arbitrary choice at all.
>
> That's not how '\dx' works, as I pointed out, so I don't see having the
> second character being 'x' to imply "\x mode" makes sense.
>

​It makes perfect sense ... it just not something that we've had the option
to do before (no, I haven't tried to figure out if we've missed an
opportunity or two here).​

​[...]​

without actual consistency across commands which take 'x'
> as a sub-command I don't see the 'descriptive' argument as holding much
> weight either
> ​.
>

​Arguing that something is mnemonic doesn't require any precedence - though
one could wish for better uses of mnemonic naming choices for past and
future items.

In scripting uses of psql I could see wanting to use "\gx" and, say "\gn"
(i.e., always output in non-expanded mode) instead of ";" so that for any
given query I can specify the exact layout I care about and don't have to
jump through hoops to toggle \x back and forth.

Limiting consideration of the use-case of this feature to interactive use
is, IMHO, a mistake. In the copious use of psql scripting that I do I
would find both options I named above to be useful to directly and
concisely communicate the display intent of each query I execute.

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-01-30 15:56:07 Re: Performance improvement for joins where outer side is unique
Previous Message Tom Lane 2017-01-30 15:49:17 Re: One-shot expanded output in psql using \G