Disable wrapping in Psql output

后端 未结 5 1453
猫巷女王i
猫巷女王i 2021-02-06 21:43

When using Psql in Linux, if the result of my SQL query contains many columns or long strings of data, it will wrap the initial view and only once I scroll to the side will it s

5条回答
  •  失恋的感觉
    2021-02-06 22:21

    Psql uses a system viewer to show its output in the console. In bash it likely uses less for the scrollable/page-able features it provides. To use a different viewer or use different settings, you just need to set the PAGER environment variable.

    Running psql to use less with the -S or --chop-long-lines option seemed to work for me:

    PAGER="less -S" psql
    

    You can also enable this feature while viewing output in less by typing -S and Enter.

提交回复
热议问题