Re: wrapping in extended mode doesn't work well with default pager

From: Greg Stark <stark(at)mit(dot)edu>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Noah Misch <noah(at)leadboat(dot)com>, Sergey Muraviov <sergey(dot)k(dot)muraviov(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Emre Hasegeli <emre(at)hasegeli(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: wrapping in extended mode doesn't work well with default pager
Date: 2014-06-11 19:59:34
Message-ID: CAM-w4HMcLb+ocOTzKfmUy1amvOFXdGPy9gUyAd12Jd267AWovQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 11, 2014 at 7:52 PM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> On 6/8/14, 11:29 PM, Noah Misch wrote:
>> The patch did not restore 9.3 behavior for that one. Starting with commit
>> 6513633, the first line of letters is space-padded on the right to the width
>> of the second line of letters. To illustrate, I have attached raw psql output
>> from both commit 6513633 and its predecessor. Also note that
>> psql-wrapped-expanded-fix-v4.patch expands each [ RECORD x ] header from 509
>> bytes to 511 bytes; 509 is the longstanding width.
>
> I noticed that (or perhaps a related) problem today. Here is a simple demo:

I don't think these two issues are related.

The leading space that you (ie Peter) are complaining about in:

col | 1
----+--
col | 2

Is there because if the cell wrapped it would get an ellipsis (ie
'...' but it's a single unicode character) in that column to indicate
that it's wrapped. However we don't wrap headers so the only reason to
change it is for the "old-ascii" linestyle:

stark=***# select * from (values (1),(2)) as _ ("col
col");
stark"***#
col | 1
+col ;
-----+-----
col | 2
+col ;

Noah's complaint is about the space padding on the *right*. Ie

stark=***# select * from (values ('foo'),('foo bar baz')) as _ ("col");
col | foo
<- This is the end of the line
-----+--------------------------------------------------------------------------<-
This is the end of the line
col | foo bar baz
<- This is the end of the line

We didn't used to do that in expanded and I kind of agree it would be
nice to avoid. But then there are lots of cases where it would still
be necessary:

stark=***# select * from (values ('foo'),('foo bar
baz')) as _ ("col");
stark'***#
col | foo
<- This is the end of the line
-----+--------------------------------------------------------------------------<-
This is the end of the line
col | foo bar
+<- This is the end of the line
| baz
<- This is the end of the line

Obviously we would need to space padd to insert the "+" there.

I think this whole exercise has mostly just convinced me we should
implement an HTTP interface and reimplement psql as a browser app.

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2014-06-11 20:00:12 Re: wrapping in extended mode doesn't work well with default pager
Previous Message Alvaro Herrera 2014-06-11 19:46:33 view reloptions