"Tom Lane" <[EMAIL PROTECTED]> writes: > Bryce Nesbitt <[EMAIL PROTECTED]> writes: >> <pre wrap="">I checked the use of COLUMNS and it seems bash updates the >> environment >> variable when a window is resized. > > [ Please get rid of the HTML formatting ... ] > > Bash can update the environment all it wants, but that will not affect > what is seen by a program that's already running. Personally I often > resize the window while psql is running, and I expect that to work.
Hm, then having COLUMNS override the ioctl isn't such a good idea. Checking GNU ls source the ioctl overrides COLUMNS if it works, but there's a --width option which trumps both of the other two. I guess just a psql variable would be the equivalent. > I'm with Peter on this one: we have used ioctl, and nothing else, to > determine the vertical window dimension for many years now, to the tune > of approximately zero complaints. It's going to take one hell of a > strong argument to persuade me that determination of the horizontal > dimension should not work exactly the same way. Well the cases are not analogous. Firstly, the window height doesn't actually alter the output. Secondly there's really no downside in a false positive since most pagers just exit if they decide the output fit on the screen -- which probably explains why no ssh users have complained... And in any case you can always override it by piping the output to a pager yourself -- which is effectively all I'm suggesting doing here. So here are your two hella-strong arguments: a) not all terminals support the ioctl. Emacs shell users may be eccentric but surely using psql over ssh isn't especially uncommon. Falling back to COLUMNS is standard, GNU ls is not alone, Solaris and FreeBSD both document supporting COLUMNS. b) you don't necessarily *want* the output formatted to fill the screen. You may be generating a report to email and want to set the width to the RFC recommended 72 characters. You may just have a full screen terminal but not enjoy reading 200-character long lines -- try it, it's really hard: MANWIDTH If $MANWIDTH is set, its value is used as the line length for which manual pages should be formatted. If it is not set, manual pages will be formatted with a line length appropriate to the current terminal (using an ioctl(2) if available, the value of $COLUMNS, or falling back to 80 characters if neither is available). Cat pages will only be saved when the default formatting can be used, that is when the terminal line length is between 66 and 80 characters. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com Ask me about EnterpriseDB's On-Demand Production Tuning -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches