?more?

Started by Jeff MacDonaldalmost 27 years ago5 messagesgeneral
Jump to latest
#1Jeff MacDonald
jeff@hub.org

When I do a large select , the results all zip past the screen
. How do I make it go page by page ? I figure this has to do
with a term setting, my default term setting is 'linux' .
I tried vt100 and vt220 .

Perhaps this is a linux-ism ?

Thanks
Jeff

#2Aaron Holtz
aholtz@bright.net
In reply to: Jeff MacDonald (#1)
Re: [GENERAL] ?more?

Do a '\g | more' instead of the ';' at the end of the query. Much easier:

select * from table \g | more

--------------------------------------------------------------------------
Aaron Holtz
ComNet Inc.
UNIX Systems Specialist
Email: aholtz@bright.net
"It's not broken, it just lacks duct tape."
--------------------------------------------------------------------------

On Jun 22, Jeff MacDonald molded the electrons to say....

Show quoted text

When I do a large select , the results all zip past the screen
. How do I make it go page by page ? I figure this has to do
with a term setting, my default term setting is 'linux' .
I tried vt100 and vt220 .

Perhaps this is a linux-ism ?

Thanks
Jeff

#3Jeff Hoffmann
jeff@remapcorp.com
In reply to: Jeff MacDonald (#1)
Re: [GENERAL] ?more?

Jeff MacDonald wrote:

When I do a large select , the results all zip past the screen
. How do I make it go page by page ? I figure this has to do
with a term setting, my default term setting is 'linux' .
I tried vt100 and vt220 .

Perhaps this is a linux-ism ?

Thanks
Jeff

look into using cursors. that way you can fetch a few records at a time
from a select.
also make sure to put it in a begin - end transaction block. i think
you can get help on declare in psql, which should tell you what you need
to know. an example of doing this would be something like:

begin;
declare cursor_name cursor for select * from test_table;
fetch 20 in cursor_name;
end;

#4Bruce Momjian
bruce@momjian.us
In reply to: Aaron Holtz (#2)
Re: [GENERAL] ?more?

Do a '\g | more' instead of the ';' at the end of the query. Much easier:

select * from table \g | more

Define PAGER, and it is automatically invoked if the data is more than
the size of the screen.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#5Herouth Maoz
herouth@oumail.openu.ac.il
In reply to: Jeff MacDonald (#1)
Re: [GENERAL] ?more?

At 17:41 +0300 on 22/06/1999, Jeff MacDonald wrote:

When I do a large select , the results all zip past the screen
. How do I make it go page by page ? I figure this has to do
with a term setting, my default term setting is 'linux' .
I tried vt100 and vt220 .

Perhaps this is a linux-ism ?

You have to set the environment variable PAGER. Usually, to "more", or
better yet, to "less".

This environment variable shoud be set by the individual user, not on the
server process or anything. Once set, it also affects other unix utilities,
such as man(1).

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma