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

From Gregory Stark
Subject Re: [SPAM] Re: Proposed patch - psql wraps at window width
Date
Msg-id 87lk2x81pw.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: Proposed patch - psql wraps at window width  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
"Peter Eisentraut" <peter_e@gmx.net> writes:

> Am Dienstag, 29. April 2008 schrieb Bruce Momjian:
>> We do look at COLUMNS if the ioctl() fails, but not for file/pipe
>> output.
>
> This is quite a useless complication.  Readline uses exactly the same ioctl() 
> call to determine the columns, so if ioctl() were to fail, then COLUMNS would 
> be unset or wrong as well.

COLUMNS is just a regular environment variable. The user is free to set it and
many people have dotfiles, aliases, or scripts which do just that. 

Consider, for example, someone with a cron job which runs several commands
such as "ls -C", "dpkg -l", and of course "psql -Pformat=wrapped" to generate
various reports and wants it all formatted to 72 columns. They would normally
just set COLUMNS=72 and run their commands and get an email all formatted to
72 columns.

But your point is valid, that's why I'm not too worried about cases where
COLUMNS is set to the desired width but readline interferes with it. In those
cases we would be using the ioctl value anyways. It would probably still be a
good idea to getenv(COLUMNS) early on before readline is initialized though.

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com Get trained by Bruce Momjian - ask me about
EnterpriseDB'sPostgreSQL training!
 


pgsql-hackers by date:

Previous
From: "dv @ nabble"
Date:
Subject: Re: SRF in SFRM_ValuePerCall mode
Next
From: "dv @ nabble"
Date:
Subject: Re: SRF in SFRM_ValuePerCall mode