Re: Proposed patch - psql wraps at window width

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Bruce Momjian" <bruce(at)momjian(dot)us>
Cc: "Bryce Nesbitt" <bryce2(at)obviously(dot)com>, "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed patch - psql wraps at window width
Date: 2008-05-06 08:38:29
Message-ID: 87prrzu8sa.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Bruce Momjian" <bruce(at)momjian(dot)us> writes:

> FYI, I looked into 'ls -C' hanlding a little more and ls (GNU coreutils)
> 5.97 honors COLUMNS _only_ in file/pipe output, not for screen output.
> What the C code does is to read COLUMNS, then overwrite that value with
> ioctl() if it works.

Well saying "file/pipe" and "screen output" is making a lot of assumptions.
The pipe may still be ending up on the screen if it's being piped to a pager.
And a "file" could still be a terminal. Also, not all terminals support the
ioctl().

What ls does is use the same logic for all cases. When the ioctl works that
takes precedence regardless of whether it's "file/pipe" or "screen output".
When it fails it uses COLUMNS instead if set.

We really must stop thinking in terms of specific use cases. You will tie
yourselves in knots if you try to enumerate all the types of terminals, places
people redirect output, and uses people might make for the output. And it will
result in very complex, hard to explain behaviour which will surprise and
disappoint users.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's 24x7 Postgres support!

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2008-05-06 11:00:13 Re: Query Hints? No thanks. Data hints?
Previous Message Michael Meskes 2008-05-06 08:04:21 Re: ecpg localization