Skip site navigation (1) Skip section navigation (2)

Tech details - psql wraps at window width

From: Bryce Nesbitt <bryce2(at)obviously(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Tech details - psql wraps at window width
Date: 2008-04-26 02:16:31
Message-ID: 4812907F.3080706@obviously.com (view raw or flat)
Thread:
Lists: pgsql-hackers
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_stream html

Where, on a stream, auto and off would have the same meaning, and \pset 
format would set both?


In response to

Responses

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2008-04-26 03:34:24
Subject: Re: Tech details - psql wraps at window width
Previous:From: Brendan JurdDate: 2008-04-26 01:36:48
Subject: Re: Proposed Patch - LDAPS support for servers on port 636 w/o TLS

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group