Re: Info about number of tuples if not use FETCH ALL - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Info about number of tuples if not use FETCH ALL
Date
Msg-id 20010813195826.B3475@svana.org
Whole thread Raw
In response to Info about number of tuples if not use FETCH ALL  ("Yusron Hilmy" <yusron@ebdesk.com>)
List 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@svana.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.

pgsql-general by date:

Previous
From: "Yusron Hilmy"
Date:
Subject: Info about number of tuples if not use FETCH ALL
Next
From: Ivan Uemlianin
Date:
Subject: Some questions on using arrays.