Re: Find out the number of rows returned by refcursor? - Mailing list pgsql-general

From Tom Lane
Subject Re: Find out the number of rows returned by refcursor?
Date
Msg-id 14743.1160676889@sss.pgh.pa.us
Whole thread Raw
In response to Re: Find out the number of rows returned by refcursor?  ("Karen Hill" <karen_hill22@yahoo.com>)
List pgsql-general
"Karen Hill" <karen_hill22@yahoo.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

pgsql-general by date:

Previous
From: "Karen Hill"
Date:
Subject: Re: Find out the number of rows returned by refcursor?
Next
From: brian
Date:
Subject: some log statements ignored