Re: Proposed patch - psql wraps at window width - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: Proposed patch - psql wraps at window width
Date
Msg-id 87lk2ntww5.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: Proposed patch - psql wraps at window width  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Proposed patch - psql wraps at window width  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
"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!


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Query Hints? No thanks. Data hints?
Next
From: Bruce Momjian
Date:
Subject: Re: Proposed patch - psql wraps at window width