Re: How to prevent clear screen when query finish? - Mailing list pgsql-general

From Condor
Subject Re: How to prevent clear screen when query finish?
Date
Msg-id 1e885aa6b20a095f855d5ad872f78f96@stz-bg.com
Whole thread Raw
In response to Re: How to prevent clear screen when query finish ?  (Adrian Klaver <adrian.klaver@gmail.com>)
Responses Re: How to prevent clear screen when query finish ?  (Chris Travers <chris.travers@gmail.com>)
Re: How to prevent clear screen when query finish ?  (Adrian Klaver <adrian.klaver@gmail.com>)
List pgsql-general
On 2013-08-07 19:01, Adrian Klaver wrote:
> On 08/07/2013 08:53 AM, Condor wrote:
>> Hello,
>>
>> sorry for dumb question, did any one can tell me how the hell I can
>> remove clear screen after finish the sql query from console ?
>> This probably have some idea, but for me look like very ... not good
>> idea. When I run query from console like:
>>
>> SELECT * FROM table_x;
>>
>> I got the result ... with (END) and when I click key -> q for quit the
>> result disappear and I can't scroll it back,
>> if I need to check something again (change console do something, get
>> one
>> line and need to scroll back) and want to see my old result again, I
>> need to run query
>> again ... I never has this problem on Slackware, but today one of my
>> partners give me a shell to his ubuntu server to fix something on
>> database.
>>
>
> The pager is probably not set, see here for more info:
>
> http://www.postgresql.org/docs/9.2/interactive/app-psql.html
>
> pager
> Controls use of a pager program for query and psql help output. If the
> environment variable PAGER is set, the output is piped to the
> specified program. Otherwise a platform-dependent default (such as
> more) is used.
>
> When the pager option is off, the pager program is not used. When the
> pager option is on, the pager is used when appropriate, i.e., when the
> output is to a terminal and will not fit on the screen. The pager
> option can also be set to always, which causes the pager to be used
> for all terminal output regardless of whether it fits on the screen.
> \pset pager without a value toggles pager use on and off.
>


Thank you,
last question: How I can find where is set this ENV ?
because:

# env
TERM=xterm
SHELL=/bin/bash
SSH_CLIENT=192.68.1.111 52614 22
SSH_TTY=/dev/pts/2
USER=root

LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;

35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
MAIL=/var/mail/root
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
PWD=/root
LANG=en_US.UTF-8
PS1=\h:\w\$
SHLVL=1
HOME=/root
LANGUAGE=en_US
LS_OPTIONS=--color=auto
LOGNAME=root
SSH_CONNECTION=192.68.1.111 52614 192.68.1.121 22
HISTTIMEFORMAT=[%Y-%m-%d %T]
_=/usr/bin/env
OLDPWD=/root


and when I enter to db:

my_db=# \set
AUTOCOMMIT = 'on'
PROMPT1 = '%/%R%# '
PROMPT2 = '%/%R%# '
PROMPT3 = '>> '
VERBOSITY = 'default'
VERSION = 'PostgreSQL 9.1.9 on x86_64-unknown-linux-gnu, compiled by gcc
(Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit'
DBNAME = 'my_db'
USER = 'postgres'
HOST = '127.0.0.1'
PORT = '5432'
ENCODING = 'UTF8'
my_db=#


I can't see this variable PAPER but yes, \pset paper work for
connection.

Cheers,
Hristo S.

> --
> Adrian Klaver
> adrian.klaver@gmail.com


pgsql-general by date:

Previous
From: Kallon Weingarten
Date:
Subject: Re: Incremental backup with RSYNC or something?
Next
From: Chris Travers
Date:
Subject: Re: How to prevent clear screen when query finish ?