0

I am novice in psql. I have a problem with an output in psql shell. Amount of columns in my table wraps, and makes the whole table unreadable. I am looking for a "\x" alternative, because it makes a data tough to read for me. I have been trying everything I found out in Internet since yesterday without a progress.

I am an Windows user, I am familiar with this post also: Alternate output format for psql

The output looks like this:

output

I am wondering If there is an option to add horizontal bar to smoothly scroll the output.

miasekk
  • 37
  • 7
  • Check this: https://stackoverflow.com/questions/20923534/how-to-set-default-display-mode-in-psql and also -x see here https://www.postgresql.org/docs/9.2/app-psql.html – AndreaTaroni86 May 15 '21 at 08:57
  • Hi Andrea, I have a following problem: "ERROR: syntax error at or near "-" LINE 1: -x. However documentation says that it is equivalent of \x, while my expected outcome is standard table with possible to scroll horizontally if output doesnt fit horizontally – miasekk May 15 '21 at 10:21

1 Answers1

0

Adding a scroll bar would be up to your terminal/console emulator, not up to PostgreSQL nor psql.

But if you use less for our pager, psql will automatically send the over-width output to less, which will then let you scroll left and right with the cursor keys. If you are scrolled all the way to the left, it will show the output as wrapped, but if you scroll to right at all it will unwrap it and show just the slice that falls within the window. It will normally scroll around in chunks of ~20 columns per keypress by default, but you can change that by hitting a number first before using the arrow keys. I just set PAGER=less in my .bashrc file, so that all programs know that my preferred pager is less. But you can also set PSQL_PAGER if you just want to set it for this one program, or you can set it on the command line for just a specific execution.

jjanes
  • 37,812
  • 5
  • 27
  • 34
  • Thank you for your lines. I am trying to execute every line I appoint in Internet, but the onyl result I get is: 'less' is not recognized as an internal or external command, operable program or batch file. I have added bath in system's variable environment but still it doesn't work. – miasekk May 16 '21 at 14:30