Aidan Van Dyk <aidan@highrise.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