\s paging?

Started by CSNabout 22 years ago3 messagesgeneral
Jump to latest
#1CSN
cool_screen_name90001@yahoo.com

Is it possible to have "less"-type paging with psql's
\s command? Or other ways like display the last 50
commands backwards?

__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

#2Ron St-Pierre
rstpierre@syscor.com
In reply to: CSN (#1)
Re: \s paging?

CSN wrote:

Is it possible to have "less"-type paging with psql's
\s command? Or other ways like display the last 50
commands backwards?

__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

Since no one has had a go at this, I'll try. The docs say that it is no
longer necessary to use the \s command because all commands are saved on
program termination. However, if you want to read/cycle through previous
commands while the app is still running you have to configure postres
with readline. Then you can just use your up/down arrows on your
keyboard to display previous commands. Also available in the few linux
distros I've used is the shift-pgUp/shift-pgDwn functionality in a
terminal to view input and output that's already scrolled off of the screen.

HTH
Ron

#3Bruce Momjian
bruce@momjian.us
In reply to: CSN (#1)
Re: \s paging?

CSN wrote:

Is it possible to have "less"-type paging with psql's
\s command? Or other ways like display the last 50
commands backwards?

I just checked and the \s code actually calls the readline library:

if (write_history(fname) == 0)

with fname set to /dev/tty if file name is supplied. The only fix we
could do would be to put a temp file in for fname, then output that
through a pager. However, it doesn't seem worth the trouble.

I added a comment in the C code if we ever come back to it.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073