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

postgresql command line windows
psql query command line
psql commands
run sql script in postgres
psql run sql file from command line
run sql file from psql prompt
connect to postgres database command line linux
postgresql prompt user for input

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

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

In this mode , commands can be issued to the PostgreSQL back end , and the responses can Command - Line Options - a , - echo - all - A , - - no - align . field separator . . d , . . dbname database - e , - echo - queries - E , . . echo - hidden - f  If a line number is specified, psql will position the cursor on the specified line of the file or query buffer. Note that if a single all-digits argument is given, psql assumes it is a line number, not a file name.

Example A-5 shows the non-interactive command helps screen. sent to server -​E, --echo-hidden display queries that internal commands generate -L, log to file -n, --no-readline disable enhanced command line editing (readline) -o, -A, --no​-align unaligned table output mode -F, --field-separator=STRING set field  Granted that when your select-statement is only a few lines of code, it doesn't make much of a difference. But if the SELECT statement is 50 lines of code, then it's really distracting (for debugging purposes) to have to include SQL in your procedural code. – cartbeforehorse Sep 6 '17 at 10:00

I had this issue and just learned about https://www.pgcli.com/, and it fixes this issue by default, and has a host of other features.

A Practical Introduction to the Advanced Open Source Database Regina O. Obe, Leo S. Hsu. -E,--echo-hidden display queries thatinternal commands generate -L, log to file -n, --no-readline disable enhanced command-line editing (readline) -​o, -A,--no-align unaligned table output mode -F,--field-separator=STRING set  Also, there is no simple way to return a null result, nor to cope with null arguments in any way other than making the function strict. The version-1 convention, presented next, overcomes these objections.

--echo-hidden Use separator as the field separator for unaligned output. Runs in single-line mode where a newline terminates an SQL command, as a That way SQL and psql commands can be freely mixed on a line. Without parameter, toggles a display of how long each SQL statement takes, in milliseconds. 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.

--echo-hidden. Echoes the actual Use separator as the field separator. This is Long options are not available on all platforms. Anything you enter in psql that begins with an unquoted backslash is a psql meta-command that is processed by psql itself. That way SQL and psql commands can be freely mixed on a line. For dividers, 1px is the correct height if you want a 1 pixel divider and is one of the exceptions for the "everything should be dip" rule. It'll be 1 pixel on all screens. Plus, 1px usually looks better on hdpi and above screens

Due to the way that PostgreSQL arranges its data storage, you may see some PostgreSQL does not impose a limit on the number of rows in any table. As long as it's practical, we suggest that you stick to the standard SQL types and Internally, PostgreSQL adds, by default, a hidden -R, --record-separator <string​>. 42 Ingeniously Easy Ways To Hide The Ugly Stuff In Your Home. there were pipes on the wall so wallpaper or tiles weren't an option. The pegboard also maximized storage because she was able to

Comments
  • I still get long wrapped divider lines, though without the [ RECORD n ].
  • Try what I suggested in my follow-up edit. It also gets rid of the border.
  • OK I tried the second, but now the long wrapped lines have been replaced by empty space. So the records are separated by many blank lines.
  • Isn't that what you wanted? I doubt you'll be able to get anything better. \x comes to mind if your number of columns are large, but you already seem to know that one.
  • I just seems that MySQL's \G option formats records with fields with very long text values better than \x on psql.
  • Good answer. I am experiencing \t (however it is toggled) not suppressing that very long, very annoying divider line. Explicitly setting \x on and \pset format wrapped in my psql terminal worked well, per this screenshot (persagen.com/files/misc/postgres-x_on-pset_align_wrapped.png). You can later override that setting with \x auto and \pset format aligned.
  • Thank you -- \pset format wrapped was the best solution I've seen.