Re: Problem with displaying "wide" tables in psql

From: Sergey Muraviov <sergey(dot)k(dot)muraviov(at)gmail(dot)com>
To: emre(at)hasegeli(dot)com
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problem with displaying "wide" tables in psql
Date: 2014-02-16 16:37:42
Message-ID: CAJTaR33+c8UegWwvnm3ykP5DvviK0fXtg6JsH3ZaJ31MKTCdmQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi.

Thanks for your review.

2014-02-15 20:08 GMT+04:00 Emre Hasegeli <emre(at)hasegeli(dot)com>:

> Hi,
>
> This is my review about 3th version of the patch. It is an useful
> improvement in my opinion. It worked well on my environment.
>
> 2013-12-11 17:43:06, Sergey Muraviov <sergey(dot)k(dot)muraviov(at)gmail(dot)com>:
> > It works in expanded mode when either format option is set to wrapped
> > (\pset format wrapped), or we have no pager, or pager doesn't chop long
> > lines (so you can still use the trick).
>
> I do not like this logic on the IsWrappingNeeded function. It does not
> seems right to check the environment variables for less. It would be hard
> to explain this behavior to the users. It is better to make this only
> the behavior of the wrapped format in expanded mode, in my opinion.
>

You are right. This logic is too complicated.
New patch works with PRINT_WRAPPED option only.

> > {
> > if (opt_border < 2)
> > fprintf(fout, "%s\n",
> dlineptr[line_count].ptr);
> > else
> > fprintf(fout, "%-s%*s
> %s\n", dlineptr[line_count].ptr,
> > dwidth -
> dlineptr[line_count].width, "",
> >
> dformat->rightvrule);
> > }
>
> Is it necessary to keep this old print line code? It seems to me the new
> code works well on (dlineptr[line_count].width <= dwidth) condition.
>

New code doesn't work with empty strings but I've done minor optimization
for this case.

--
Best regards,
Sergey Muraviov

Attachment Content-Type Size
fix_psql_print_aligned_vertical_v4.patch text/x-patch 3.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-02-16 17:12:42 Re: Changeset Extraction v7.6.1
Previous Message Tom Lane 2014-02-16 16:25:05 Re: narwhal and PGDLLIMPORT