Re: Proposed patch - psql wraps at window width

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Aidan Van Dyk <aidan(at)highrise(dot)ca>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Gregory Stark <stark(at)enterprisedb(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Bryce Nesbitt <bryce2(at)obviously(dot)com>, 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-05-06 15:48:35
Message-ID: 14733.1210088915@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Aidan Van Dyk <aidan(at)highrise(dot)ca> writes:
> But one of the interesting things is that psql has an is *interactive*
> mode (something the GNU utils don't have to worry about). So *when* you
> choose to figure out your columns is important, and really impacts
> behaviour too.

Well, COLUMNS has no hope of tracking on-the-fly changes of window size,
which is why the ioctl should take precedence over it.

> Correctly documenting it is good, just as the version of GNU ls I have
> on Debian, where I see:
> `-w'
> `--width=COLS'
> Assume the screen is COLS columns wide. The default is taken from
> the terminal settings if possible; otherwise the environment
> variable `COLUMNS' is used if it is set; otherwise the default is
> 80.

Fedora 8 has the same wording in "info ls". Possibly Bruce was reading
the man page, which is not as complete (and admits it).

Experimentation on OS X (BSD clone) shows that its "ls" believes COLUMNS
in preference to ioctl, so there's clearly scope for argument; but on
the whole I think we should follow the GNU behavior. The BSD version's
behavior is full of enormous amounts of historical cruft (and its man
page admits that) --- I suspect the behavior on this point "just grew"
instead of being carefully thought about.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-05-06 15:56:42 Re: [GENERAL] psql \pset pager
Previous Message Bruce Momjian 2008-05-06 15:37:57 Re: [GENERAL] psql \pset pager