As the originator of the "psql wraps at window width" patch, I'd like to
set a matter or two straight:
The ioctl() function does not fail under ssh, contrary to the assertion
made several times. Nor does $COLUMNS remain static if the window size
changes. $COLUMNS is not a property of a bash, you'll find it is set by
the readline library. $COLUMNS is not fully cross-platform, though
$MANWIDTH should be fine. Please supply counter examples if needed, but
this is pretty well traveled ground. I think the original patch is fat
and happy as far as interactive terminal use.
But I agree it's not desirable to wrap file any sort of stream output,
by default, as that would break just about any script known to mankind.
Yet wrapping is a very user-friendly default for interactive terminals.
This is potentially an irreconcilable inconsistency.
I weigh in on the side of leaving it inconsistent, but making it really
easy to force the behavior you want with something like: \pset format wrap [auto|nnn|off]
But that leaves a big hole: what does the setting in .psqlrc refer to?
Do we need separate controls in .psql?
\pset format_terminal wrap [auto|nnn|off] \pset format_terminal html \pset format_stream wrap [auto|nnn|off] \pset
format_streamhtml
Where, on a stream, auto and off would have the same meaning, and \pset
format would set both?