"Tom Lane" <tgl@sss.pgh.pa.us> writes:
> Bruce Momjian <bruce@momjian.us> writes:
>> Are others OK with $COLUMNS controlling screen output and file/pipe, or
>> perhaps COLUMNS controlling only file/pipe, as GNU ls does? I have
>> heard a few people say they only want \pset columns to control
>> file/pipe.
>
> I agree with the latter. Anyone who is setting COLUMNS is going to set
> it to reflect the *screen* width they want; it has zero to do with
> what should happen for output going somewhere else than the screen.
That's just not true. Consider someone writing a cron job script who wants
their output formatted to 72 columns. They would set COLUMNS to direct all the
programs in the cron job script and be annoyed if some of them ignored it.
Consider also an application like pgadmin which might want to run a script in
a window and control how wide the output is.
I think you need a stronger reason to disregard the user's explicit settings
than assuming that you know what the user's planning to do with the resulting
data. Just because the output has been redirected doesn't mean it wasn't
redirected to something like "more" or "head" or whatever with the result
*still* showing up on the screen.
It's one thing to change the default behaviour. It's another to disregard
user-requested options.
-- Gregory Stark EnterpriseDB http://www.enterprisedb.com Ask me about EnterpriseDB's 24x7 Postgres support!