Re: psql \G command -- send query and output using extended format - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: psql \G command -- send query and output using extended format
Date
Msg-id 20080404223033.GD20967@alvh.no-ip.org
Whole thread Raw
In response to Re: psql \G command -- send query and output using extended format  ("Dawid Kuroczko" <qnex42@gmail.com>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Gregory Stark
Date:
Subject: Re: modules
Next
From: Tom Lane
Date:
Subject: Re: Garbage pad bytes within datums are bad news