Skip site navigation (1) Skip section navigation (2)

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

From: "Dawid Kuroczko" <qnex42(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql \G command -- send query and output using extended format
Date: 2008-04-03 14:49:21
Message-ID: 758d5e7f0804030749j152ab2aer5616f107d528157e@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
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.

   Regards,
     Dawid

In response to

Responses

pgsql-hackers by date

Next:From: Andrew DunstanDate: 2008-04-03 14:55:39
Subject: Re: modules
Previous:From: Hell, RobertDate: 2008-04-03 14:45:30
Subject: GUC parameter cursors_tuple_fraction

pgsql-patches by date

Next:From: Bernd HelmleDate: 2008-04-03 14:49:43
Subject: Re: psql command aliases support
Previous:From: Hell, RobertDate: 2008-04-03 14:45:30
Subject: GUC parameter cursors_tuple_fraction

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group