pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Verite <daniel@manitou-mail.org>
To: Platon Pronko <platon7pronko@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: very long record lines in expanded psql output
Date: Thu, 05 Aug 2021 21:40:01 +0200
Message-ID: <ff859207-e7d9-49dc-a254-387a49e6dc46@manitou-mail.org> (raw)
In-Reply-To: <f03d38a3-db96-a56e-d1bc-dbbc80bbde4d@gmail.com>

	Platon Pronko wrote:

> Maybe we can avoid making the header line longer than terminal width
> for \pset border 0 and \pset border 1? We already have terminal
> width calculated. Please see attached a patch with the proposed
> implementation.

+1 for doing something against these long lines.

Rather than padding up to the terminal's width, we could simply end
the line after the "-[RECORD N]-" marker, with the idea that the
rest of it does not add much to readability anyway. 
And when writing into a file as opposed to a terminal, getting rid of
these lines is useful too.

In that case, your example could be displayed like this:

=> \pset expanded on
=> \pset border 1

=> select n, repeat('x', n) as long_column_name from unnest(array[42,210])
 as n;

-[ RECORD 1 ]-
n		 | 42
long_column_name | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-[ RECORD 2 ]-
n		 | 210
long_column_name |
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

=> \pset border 0
=> select n, repeat('x', n) as long_column_name from unnest(array[42,210])
 as n;

* Record 1
n		 42
long_column_name xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
* Record 2
n		 210
long_column_name
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



Best regards,
-- 
Daniel Vérité
PostgreSQL-powered mailer: https://www.manitou-mail.org
Twitter: @DanielVerite





view thread (39+ messages)  latest in thread

Message-ID: <ff859207-e7d9-49dc-a254-387a49e6dc46@manitou-mail.org>
Permalink:  ../ff859207-e7d9-49dc-a254-387a49e6dc46@manitou-mail.org/
Also on:    postgresql.org/message-id/ff859207-e7d9-49dc-a254-387a49e6dc46@manitou-mail.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: daniel@manitou-mail.org, platon7pronko@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: very long record lines in expanded psql output
  In-Reply-To: <ff859207-e7d9-49dc-a254-387a49e6dc46@manitou-mail.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox