Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set less as pager in psql

I can't set less as pager in psql.

This is my environment:

  • Ubuntu 14.04
  • PostgreSQL 9.3.5
  • psql 9.3.5
  • Fish shell 2.1.1

~/.psqlrc contents:

# \setenv PAGER less
\x auto
\timing
\set VERBOSITY verbose
\pset null 'NULL'
\pset pager on
\set HISTSIZE
\set PROMPT1 '(%n@%M:%>) [%/] > '
\set PROMPT2 '%[%033[8m%](%n@%M:%>) [%/] >[%033[0m%]%'

env | grep PAGER:

PAGER=less

Neverthless this, when I digit \dSpaceTabTaby I get:

table another_table
table another_table
...
--More--
like image 457
mdesantis Avatar asked Oct 08 '14 13:10

mdesantis


1 Answers

The display of this line (--More--) and the forward-only scrolling capability in tab-completion come from the internal pager of the readline library, as opposed to an external pager. psql lets this library handle the UI-side of tab-completion.

This paging may be turned off in .inputrc with set page-completions to off , but it's not replaceable by an external program, at least not in the current versions of GNU readline.

In the context of displaying query results, the PAGER environment variable normally works as documented.

like image 89
Daniel Vérité Avatar answered Sep 18 '22 19:09

Daniel Vérité