Re: Paging Through Query Result Sets

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: psycopg(at)postgresql(dot)org
Subject: Re: Paging Through Query Result Sets
Date: 2013-04-22 07:57:39
Message-ID: 20130422075739.GB3958@hermes.hilbert.loc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On Fri, Apr 19, 2013 at 06:38:32PM -0400, Don Parris wrote:

> I would like to be able to page through a result set when there is more
> than one screenful of data. Is there a good example of paging through a
> query result set in Bash - something like implementing the less command?

If Bash really is your implementation language one of your
best bets may be to download the entire resultset into a
text file and *actually* less'ing through that.

Other than that, something akin to a local file may be
constructed by judicious use of pipes.

psql ... -c 'select interesting rows;' | less

should do the trick, no ?

Karsten
--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

In response to

Browse psycopg by date

  From Date Subject
Next Message Devrim GÜNDÜZ 2013-05-01 18:41:23 Psycopg2 for PostgreSQL 9.3
Previous Message Joe Abbate 2013-04-19 22:55:42 Re: Paging Through Query Result Sets