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.