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

From Tom Lane
Subject Re: Proposed patch - psql wraps at window width
Date
Msg-id 14733.1210088915@sss.pgh.pa.us
Whole thread Raw
In response to Re: Proposed patch - psql wraps at window width  (Aidan Van Dyk <aidan@highrise.ca>)
Responses Re: Proposed patch - psql wraps at window width  (Peter Eisentraut <peter_e@gmx.net>)
Re: Proposed patch - psql wraps at window width  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] psql \pset pager
Next
From: Tom Lane
Date:
Subject: Re: [GENERAL] psql \pset pager