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>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>, "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, "Brendan Jurd" <direvus(at)gmail(dot)com>, <heikki(at)enterprisedb(dot)com>
Subject: Re: Proposed patch - psql wraps at window width
Date: 2008-04-29 02:57:17
Message-ID: 87tzhl8j1u.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:

> Gregory Stark wrote:
>> "Bryce Nesbitt" <bryce2(at)obviously(dot)com> writes:
>>
>> > Unless they are in the habit of doing:
>> >
>> > # COLUMNS=$COLUMNS ls -C |cat
>>
>> Some of us are actually in the habit of doing that because it's easier to use
>> the standard interface than remembering the different command-line option for
>> each command. I quite often do precisely that with dpkg, for example.
>
> Yes, this is true, but it assume the application is not going to set
> $COLUMNS itself, like psql does in interactive mode:
>
> test=> \echo `echo $COLUMNS`
> 127
>
> $ sql -c '\echo `echo $COLUMNS`' test
> (empty)
>
> Now, we could get fancy and honor $COLUMNS only in non-interactive mode,
> but that seems confusing.

We could always read COLUMNS early on before readline is initialized and stash
the value away in a variable. But...

We would only look at COLUMNS if the ioctl for window size failed. Does
psql/readline do anything to COLUMNS in that case?

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's RemoteDBA services!

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2008-04-29 03:11:50 Re: Proposed patch - psql wraps at window width
Previous Message Tom Lane 2008-04-29 02:26:50 Re: [COMMITTERS] pgsql: Add generate_subscripts, a series-generation function which