2

I'm connected remotly to my database server with cygwin in full screen.

When I query my database with

   select id, name from table limit 27;

I get 27 records and I can do a new query seeing the result of the previous query.

But, If I replace 27 by 28, I see 28 records in one screen with an (End) in reverse video. If I want to do a new query, I have to press q.

I can't see the result of the previous query even if I use the scrollbar of my cygwin window.

Which option do I have to modify to increase this buffer ?

My psql client and database server version is 9.1.4 and they are installed on Ubuntu 12.04

2 Answers 2

5

You can turn off (and on) the paging in psql:

\pset pager [on|off]

If you don't specify on or off, the command will toggle the setting. (More on \pset in the documentation.) In the shell, you can even set the pager you want to use:

PAGER=/usr/bin/less

If you start psql after this, less will be your pager.

1
  • 1
    Thank you. FYI, if you want to use it with psql -c "sql query", you have to add "-P pager=off" Then you would have psql -P pager=off -c query
    – Luc M
    Commented Aug 1, 2012 at 13:43
3

Assuming less is used as the pager, you can turn off this screen-clearing feature which indeed is annoying within psql. Use the -X option:

  -X or --no-init
          Disables sending the termcap initialization and deinitialization
          strings to the terminal.  This is  sometimes  desirable  if  the
          deinitialization  string does something unnecessary, like clear‐
          ing the screen.

The option can be set as an environment variable in your $HOME/.profile init file:

LESS="-X"
export LESS

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.