Re: Find out the number of rows returned by refcursor?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Karen Hill" <karen_hill22(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Find out the number of rows returned by refcursor?
Date: 2006-10-12 18:14:49
Message-ID: 14743.1160676889@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Karen Hill" <karen_hill22(at)yahoo(dot)com> writes:
>> Cool. Quick question, how does one go about noting the rowcount?
>> Using the rowcount in get diagnostics or something else?

> A "MOVE FORWARD ALL FROM cur;" statement returns "MOVE x". Where x is
> the number moved. The result seems to be of a NOTICE type, and I'm not
> sure how I can pass that as a result from a pgsql function.

Um ... sorry, you can't really. I was thinking of doing this from
client-side logic, where that count is normally going to be accessible
as part of the command status. plpgsql has a pretty limited set of
cursor features --- I don't think it lets you get at MOVE ALL at all,
let alone check the number of rows moved over. Can you push the
operation over to the client side?

(We ought to try to improve that situation in future releases, but that
won't help you today.)

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Guillaume Lelarge 2006-10-12 18:20:33 Re: [GENERAL] ISO week dates
Previous Message Karen Hill 2006-10-12 17:48:51 Re: Find out the number of rows returned by refcursor?