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

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: 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:35:33
Message-ID: 20170130153532.GE9812@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

Further, as it relates to formatting, "\x mode" is, far and away in my
experience, the only regularly used alternative formatting in
interactive psql sessions.

I can't recall ever using the other formatting toggles (aligned, HTML,
and tuples only) before in interactive sessions, except (rarely) with
\o. I tend to think we've got them primairly to provide the same
options that we have at the command-line, which can be handy, but not
because I'm very often going to want to flip between aligned and
unaligned mode while querying tables.

> The main problem I see with \G is that it's a dead end. If somebody
> comes along next year and says "I'd like a variant of \g with some other
> frammish", what will we do? There are no more case variants to use.

I don't believe there's any reason to think someone else couldn't come
along later and add \gq for whatever they want. Simply because we use
\G for something doesn't mean \g can't ever be further extended.

> In short, really the direction this ought to go in is \g[options] [file]
> which is perfectly consistent with precedents in psql such as \d.
> But there isn't any place where we've decided that upper case means
> a variant of a lower case command.

I agree that we don't currently have a case that upper case means a
variant of a lower case command, but I'm not arguing that we do.

We do have cases where various \d sub-commands end up being very
different things depending on if it's a lower-case letter or an
upper-case letter, but that doesn't imply, to me at least, that every
use of an upper-case letter must be completely different from what the
lower-case letter is for.

Obviously, I'd like to have this and if enough people think that the
right answer is '\gx', then so be it, but I don't buy the consistency
argument and without actual consistency across commands which take 'x'
as a sub-command I don't see the 'descriptive' argument as holding much
weight either.

Thanks!

Stephen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-01-30 15:43:29 Re: Superowners
Previous Message Peter Eisentraut 2017-01-30 15:34:34 Re: Superowners