Re: Info about number of tuples if not use FETCH ALL

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Yusron Hilmy <yusron(at)ebdesk(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Info about number of tuples if not use FETCH ALL
Date: 2001-08-13 09:58:26
Message-ID: 20010813195826.B3475@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Aug 13, 2001 at 04:54:07PM +0700, Yusron Hilmy wrote:
> How to get number of tuples if after DECLARE CURSOR, I use FETCH NEXT (not
> FETCH ALL) ?
> PQntuples only work well if I use FETCH ALL.

You can't. The whole purpose of cursors is so that you don't have to wait
for the entire query to complete to get some results. Obviously, to get the
total number of tuples the whole query needs to be run, hence the FETCH ALL.

Do you really need to know the number of tuples beforehand, or is it ok to
wait till the end?

--
Martijn van Oosterhout <kleptog(at)svana(dot)org>
http://svana.org/kleptog/
> It would be nice if someone came up with a certification system that
> actually separated those who can barely regurgitate what they crammed over
> the last few weeks from those who command secret ninja networking powers.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Walter 2001-08-13 11:52:54 Newbie: Solution?
Previous Message Yusron Hilmy 2001-08-13 09:54:07 Info about number of tuples if not use FETCH ALL