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

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Dawid Kuroczko <qnex42(at)gmail(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, 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-04 22:30:33
Message-ID: 20080404223033.GD20967@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Dawid Kuroczko escribió:

> Hmm, seems doable.

I think that the followup discussion leads to implementing just \G (and
\x auto).

> I think there should be a format Enum, which would take values like NORMAL,
> EXTENDED, and EXTENDED_ONCE -- but this would be a much more invasive patch.
> Oh, and coincidentally its where AUTO format should go. :)

If the code ends up better with a more invasive patch, by all means do
that.

> 3. We should decide how each of the "commands" work in auto mode.
> I think it should be something like: "if output is less or equal than
> screen width -- use normal mode, else extended". I we have \g and \G,
> they should be handled a bit differently in auto mode:
> ";" -- perform automatic format adjustment
> "\g" -- force normal mode (probably for file-output)
> "\G" -- force extended mode (probably for file-output).
> I especially would like an opinion on this from you.

Sounds good -- in auto mode, you can override it if you want (unless it
is one backslash command, but I don't think that's a problem)

> 4. And as for using "\x" for the one-shot expanded output, I think it would
> be possible to allow queries like:
> SELECT * FROM foo\x
> ...but I think fundamental problem with this approach is that it promotes
> "\x" to be able to submit query. I don't think its a good idea.

No, I don't think this is a good idea either. Let's just not implement
\x.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-04-04 22:40:04 Re: Garbage pad bytes within datums are bad news
Previous Message Gregory Stark 2008-04-04 22:20:10 Re: modules

Browse pgsql-patches by date

  From Date Subject
Next Message Alvaro Herrera 2008-04-04 23:56:02 Re: libpq type system 0.9a
Previous Message Dawid Kuroczko 2008-04-04 22:15:29 Re: psql \G command -- send query and output using extended format