Re: 9.5Beta1 psql wrapped format expanded output

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 9.5Beta1 psql wrapped format expanded output
Date: 2015-11-30 23:45:54
Message-ID: CAMkU=1wTNUrXgPmBj4C6Ly44G_+yvinE7aj++2-BCvnVT_-d3w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Nov 30, 2015 at 2:59 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Jeff Janes <jeff(dot)janes(at)gmail(dot)com> writes:
>> On Fri, Oct 23, 2015 at 5:11 PM, Jeff Janes <jeff(dot)janes(at)gmail(dot)com> wrote:
>>> Why swidth for border 2 is three greater than it is with border 1, I
>>> don't really know.
>
>> Now I see why. Border 2 doesn't just add a '|' on either end of the line,
>> but also adds a space to the left end, so that the "column" name is not
>> hard up against the preceding '|'
>
> I looked this over and concluded that the real problem was that the logic
> that added space for newline/wrap marker columns was many bricks shy of a
> load. For example it had
>
> if ((opt_border < 2) &&
> ((hmultiline &&
> (format == &pg_asciiformat_old)) ||
> (dmultiline &&
> (format != &pg_asciiformat_old))))
> iwidth++; /* for newline indicators */
>
> which aside from being nearly unreadable conflated the header wrap column
> with the data wrap column; and even if those had identical conditions for
> being added, which they don't, you'd need to count two more columns here
> not just one.
>
> I rewrote it to correspond more accurately to what the printing logic
> actually does, and pushed it as 0e0776bc9. Let me know if you still see
> any problems here.
>
> regards, tom lane

The wrapping behavior looks good now, and the code is much more understandable.

Thanks,

Jeff

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2015-11-30 23:47:10 Re: CustomScan in a larger structure (RE: CustomScan support on readfuncs.c)
Previous Message Tom Lane 2015-11-30 23:37:48 Re: gincostestimate and hypothetical indexes