pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedNumber of dashes in the expanded view of psql
2+ messages / 2 participants
[nested] [flat]
* Number of dashes in the expanded view of psql
@ 2023-06-03 10:12 Rajiv Harlalka <rajivharlalka009@gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Rajiv Harlalka @ 2023-06-03 10:12 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Hello,
While watching results of some internal tables in pg , looked that the
number of dashes between records depends on the char length of the longest
column (referring to dashes here -[ RECORD 1 ]-------------).
Wouldn't it be better to have a better method for number of such dashes as
for tables having arrays or similar datatypes, if the length of entry is
long enough this can fill up entire TERM_HEIGHT.
Regards,
Rajiv Harlalka,
Attachments:
test.txt (text/plain, 832B) download
-[ RECORD 1 ]------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
a | aaaaaaaaaa
-[ RECORD 2 ]------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
a | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Number of dashes in the expanded view of psql
@ 2023-06-03 15:05 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Rajiv Harlalka <rajivharlalka009@gmail.com>
0 siblings, 0 replies; 2+ messages in thread
From: Adrian Klaver @ 2023-06-03 15:05 UTC (permalink / raw)
To: Rajiv Harlalka <rajivharlalka009@gmail.com>; pgsql-general@lists.postgresql.org
On 6/3/23 03:12, Rajiv Harlalka wrote:
> Hello,
> While watching results of some internal tables in pg , looked that
> the number of dashes between records depends on the char length of the
> longest column (referring to dashes here -[ RECORD 1 ]-------------).
> Wouldn't it be better to have a better method for number of such dashes
> as for tables having arrays or similar datatypes, if the length of entry
> is long enough this can fill up entire TERM_HEIGHT.
>
> Regards,
> Rajiv Harlalka,
>
From
https://www.postgresql.org/docs/current/app-psql.html
\pset
format
...
wrapped format is like aligned but wraps wide data values across
lines to make the output fit in the target column width. The target
width is determined as described under the columns option. Note that
psql will not attempt to wrap column header titles; therefore, wrapped
format behaves the same as aligned if the total width needed for column
headers exceeds the target.
...
columns
Sets the target width for the wrapped format, and also the width
limit for determining whether output is wide enough to require the pager
or switch to the vertical display in expanded auto mode. Zero (the
default) causes the target width to be controlled by the environment
variable COLUMNS, or the detected screen width if COLUMNS is not set. In
addition, if columns is zero then the wrapped format only affects screen
output. If columns is nonzero then file and pipe output is wrapped to
that width as well.
So:
create table wide_test(id integer, fld_1 varchar, fld_2 varchar);
insert into wide_test values (1,
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'), (2,
'ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
'dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd');
In below I am not showing output as is it is distorted by email client.
You can use the above table and data to see the effect of changing the
format.
test(5432)=# \pset format aligned
Output format is aligned.
test(5432)=# select * from wide_test ;
test(5432)=# \pset format wrapped
Output format is wrapped.
test(5432)=# select * from wide_test ;
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2023-06-03 15:05 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-06-03 10:12 Number of dashes in the expanded view of psql Rajiv Harlalka <rajivharlalka009@gmail.com>
2023-06-03 15:05 ` Adrian Klaver <adrian.klaver@aklaver.com>
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