Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to hide the long divider lines in PostgreSQL's expanded output?

Tags:

postgresql

In psql, with \x toggled to expanded output mode, I get these very long wrapped dashed lines for record separators when there is a field with a long string value in one of the selected records. They look like

-[ RECORD 2 ]----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- (is much longer)

Is there any way to suppress or shorten these lines? I'm on PostgreSQL 8.4

like image 613
dan Avatar asked Jun 10 '11 12:06

dan


2 Answers

Try \t:

test=# select * from test limit 1;
-[ RECORD 1 ]-------------------
id      | 1
name    | foo

test=# \t
Showing only tuples.
test=# select * from test limit 1;
id      | 1
name    | foo

Docs.


Also try:

test=# \pset border 0
Border style is 0.
backend=# select * from test limit 2;
id      1
name    foo

id      2
name    bar
like image 143
Denis de Bernardy Avatar answered Nov 11 '22 17:11

Denis de Bernardy


I had the same issue, using these two psql command line flags solved the issue for me:

  • \x (good for records with lots of columns)
  • \pset format wrapped (wraps the postgres output to your terminal width)

I got the response from this dba stackexchange article

like image 5
FelizNaveedad Avatar answered Nov 11 '22 15:11

FelizNaveedad