Re: psql \G command -- send query and output using extended format

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Dawid Kuroczko <qnex42(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql \G command -- send query and output using extended format
Date: 2008-04-03 16:07:54
Message-ID: 200804031607.m33G7sL23552@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Dawid Kuroczko wrote:
> On Thu, Apr 3, 2008 at 4:35 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > "Dawid Kuroczko" <qnex42(at)gmail(dot)com> writes:
> > > The idea of \G command is to perform the query, but with printing
> > > query results using extended table output format.
> >
> > Seems a bit useless --- if you prefer \x format, wouldn't you prefer it
> > all the time? Or at least often enough that the toggling command is
> > fine? I'm dubious that this is worth eating up a command letter for.
>
> No, the point is that I usually have mixed queries -- ones which are
> most comfortably viewed in normal format (many not-so-long rows),
> and ones which are best viewed expanded (little rows, many columns).
>
> Alternating between formats using "\x" is, at least for me, a bit
> cumbersome: usually _after_ I wrote a query I realize "it would
> look more readable in expanded format", which is a bit too late.
> So I run the query, ctrl+c, \x, rerun the query... and forget to
> turn expanded mode off afterwards.
>
> I think that ability to decide about the format after the query,
> not before, can be quite useful especially when writing ad-hoc
> queries. Incidentally "\g" and "\G" is also used more or less
> similarily by our dolphin-loving friends -- which doesn't help
> using "\G" for other things.

It seems more helpful if there were \x option to use extended format
only when the output is too wide. TODO already has:

o Add auto-expanded mode so expanded output is used if the row
length is wider than the screen width.

Consider using auto-expanded mode for backslash commands like \df+.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Brendan Jurd 2008-04-03 16:10:26 Re: printTable API (was: Show INHERIT in \du)
Previous Message Peter Eisentraut 2008-04-03 16:00:41 Re: modules

Browse pgsql-patches by date

  From Date Subject
Next Message Gregory Stark 2008-04-03 16:09:49 Re: psql command aliases support
Previous Message Bruce Momjian 2008-04-03 15:50:47 Re: Configurable Penalty Costs for Levenshtein