when i read "command line" i took it as the unix commmand line, in which case
you can do something like this
psql -c "SELECT * FROM tablename" databasename | less
or , like others said, if PAGER is set properly, you can leave off the |less
jeff
On Tue, 27 Feb 2001, Norman J. Clarke wrote:
> Martin,
>
> What platform are you running psql on? On Unix all you have to do is set
> your shell environment variable PAGER (PAGER=more or PAGER=less) and psql
> will then do what you want. If you're running it on Windows, though, I'm
> not sure what to suggest. If your postgresql installation is running on a
> Unix server, you might telnet to that machine and run psql from there.
>
> Norm
>
> --------------------------------------
> Norman Clarke
> Combimatrix Corp Software Development
> Harbour Pointe Tech Center
> 6500 Harbour Heights Pkwy, Suite 301
> Mukilteo, WA 98275
>
> tel: 425.493.2240
> fax: 425.493.2010
> --------------------------------------
>
> On Tue, 27 Feb 2001 martin.chantler@convergys.com wrote:
>
> > I am wondering if a very useful feature of some DB's is available in
> > postgres
> >
> > For example in DB2 you can execute SQL from the command line (via terminal
> > emulator)
> > It will perform it entirely then display the results, but only one page at
> > a time
> > You can then page down and page up within the results (or scroll across)
> >
> > I notice that PSQL doesn't do this which makes large tables difficult to
> > maintain
> > Of course you could put a decent Where clause in but in the real world most
> > people
> > like to narrow things down to a certain point then scroll around a few
> > hundred records
> > looking for the data by hand. Currently this doesn't seem to be possible
> >
> > The only way I can think of doing this is to write a program in C (or use
> > ODBC/JDBC) to
> > perform the SQL then retrieve x records and display them and allows paging
> > to be performed
> > When paging down the current set would be cached so that page up's would be
> > possible
> >
> > Doing this in VB would be easy and you could allow data to be editted to...
> >
> > NB Unfortunately MS Access is no good because it tries to load ALL the data
> > in one go and
> > you CANT get out of it!!!
> >
> > Anyone got any better ideas???
> >
> > Martin C.
>
Jeff MacDonald,
-----------------------------------------------------
PostgreSQL Inc | Hub.Org Networking Services
jeff@pgsql.com | jeff@hub.org
www.pgsql.com | www.hub.org
1-902-542-0713 | 1-902-542-3657
-----------------------------------------------------
Facsimile : 1 902 542 5386
IRC Nick : bignose
PGP Public Key : http://bignose.hub.org/public.txt