Re: Problem with displaying "wide" tables in psql

From: Sameer Thakur <samthakur74(at)gmail(dot)com>
To: Sergey Muraviov <sergey(dot)k(dot)muraviov(at)gmail(dot)com>
Cc: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problem with displaying "wide" tables in psql
Date: 2013-12-18 06:43:32
Message-ID: CABzZFEv8HCOQy1FiXg2ZE+Cd5uJeCR-8SqHfDfcsSNz4imnZJQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 11, 2013 at 11:13 PM, Sergey Muraviov
<sergey(dot)k(dot)muraviov(at)gmail(dot)com> wrote:
> Hi.
>
> I've improved the patch.
> 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).
> Target output width is taken from either columns option (\pset columns 70),
> or environment variable $COLUMNS, or terminal size.
> And it's also compatible with any border style (\pset border 0|1|2).
>
> Here are some examples:
>
> postgres=# \x 1
> postgres=# \pset format wrapped
> postgres=# \pset border 0
> postgres=# select * from wide_table;
> * Record 1
> value afadsafasd fasdf asdfasd fsad fas df sadf sad f sadf sadf sa df
> sadfsadfa
> sd fsad fsa df sadf asd fa sfd sadfsadf asdf sad f sadf sad fadsf
> * Record 2
> value afadsafasd fasdf asdfasd
>
> postgres=# \pset border 1
> postgres=# \pset columns 70
> postgres=# select * from wide_table;
> -[ RECORD 1 ]---------------------------------------------------------
> value | afadsafasd fasdf asdfasd fsad fas df sadf sad f sadf sadf sa
> | df sadfsadfasd fsad fsa df sadf asd fa sfd sadfsadf asdf sad f
> | sadf sad fadsf
> -[ RECORD 2 ]---------------------------------------------------------
> value | afadsafasd fasdf asdfasd
>
> postgres=# \pset border 2
> postgres=# \pset columns 60
> postgres=# select * from wide_table;
> +-[ RECORD 1 ]---------------------------------------------+
> | value | afadsafasd fasdf asdfasd fsad fas df sadf sad f |
> | | sadf sadf sa df sadfsadfasd fsad fsa df sadf as |
> | | d fa sfd sadfsadf asdf sad f sadf sad fadsf |
> +-[ RECORD 2 ]---------------------------------------------+
> | value | afadsafasd fasdf asdfasd |
> +-------+--------------------------------------------------+
>
> Regards,
> Sergey
>

The patch applies and compile cleanly. I tried the following
\pset format wrapped
\pset columns 70.
Not in expanded mode
select * from wide_table works fine.
select * from pg_stats has problems in viewing. Is it that pg_stats
can be viewed easily only in expanded mode i.e. if columns displayed
are wrapped then there is no way to view results in non expanded mode?
regards
Sameer

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2013-12-18 07:33:48 Re: row security roadmap proposal
Previous Message Michael Paquier 2013-12-18 06:00:38 Re: Logging WAL when updating hintbit