PSQL 8.3+ client query results display

血红的双手。 提交于 2019-12-09 09:25:15

问题


Rather silly question, but I can't seem to find the answer in the docs or man pages.

Starting with 8.3 I think, the psql CLI client will not display the results of a large query inline. It pipes to a 'less-like' result viewer that disappears when you hit q.

This makes it very difficult to use data from the first query in subsequent queries or updates.

Does anyone know of a switch or way to force psql to display the query results inline, like the old client did?

edit: the \x switch does this, but I need the multiple row view.


回答1:


\pset pager off

\pset pager on

\pset pager always

Alternatively, configure the pager to your liking.




回答2:


in addition to \pset pager always add the following in your .profile (or .bashrc)

export PAGER=less

export LESS="-iMSx4 -FX"



回答3:


You can also disable it when you start up psql:

$ psql -U admin db_name --pset pager=off

If you always want it to be off, you can add this to your .bashrc file:

alias psql='psql --pset pager=off'


来源:https://stackoverflow.com/questions/1982453/psql-8-3-client-query-results-display

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!