Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PSQL 8.3+ client query results display

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.

like image 729
Sheldon Ross Avatar asked Dec 30 '09 20:12

Sheldon Ross


2 Answers

\pset pager off

\pset pager on

\pset pager always

Alternatively, configure the pager to your liking.

like image 112
Gunnlaugur Briem Avatar answered Nov 09 '22 16:11

Gunnlaugur Briem


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

export PAGER=less

export LESS="-iMSx4 -FX"
like image 39
Herbie Avatar answered Nov 09 '22 15:11

Herbie