Re: psql expanded auto - Mailing list pgsql-hackers

From Noah Misch
Subject Re: psql expanded auto
Date
Msg-id 20111105162627.GB32349@tornado.leadboat.com
Whole thread Raw
In response to Re: psql expanded auto  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: psql expanded auto
List pgsql-hackers
On Sat, Nov 05, 2011 at 04:53:56PM +0200, Peter Eisentraut wrote:
> On fre, 2011-11-04 at 07:34 -0400, Noah Misch wrote:
> > For "\pset format wrapped", we only use $COLUMNS when the output is a
> > tty.  I'm thinking it's best, although not terribly important, to
> > apply the same rule to this feature.
> 
> I think it does work that way.  There is only one place where the
> environment variable is queries, and it's used for both wrapped format
> and expanded auto format.

You're correct; given output to a non-tty and no use of \pset columns,
output_columns always becomes zero.  This makes wrapped format never wrap, but
it makes expanded auto mode always expand.  Would it be more consistent to never
expand when output_columns == 0?  That is, make these give the same output:

psql -X -P expanded=auto -c "select 'a' as a"
psql -X -P expanded=auto -c "select 'a' as a" | cat

I just noticed: the help text for \x in slashUsage() will also need an update.


pgsql-hackers by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: [GENERAL] Strange problem with create table as select * from table;
Next
From: Peter Eisentraut
Date:
Subject: Re: pg_upgrade automatic testing