Re: Performing FETCH ALL from a SCROLL CURSOR failing to return results - Mailing list pgsql-general

From Tom Lane
Subject Re: Performing FETCH ALL from a SCROLL CURSOR failing to return results
Date
Msg-id 24903.1269553430@sss.pgh.pa.us
Whole thread Raw
In response to Performing FETCH ALL from a SCROLL CURSOR failing to return results  (Eliot Gable <egable+pgsql-general@gmail.com>)
List pgsql-general
Eliot Gable <egable+pgsql-general@gmail.com> writes:
> Inside my PL/PGSQL stored procedure, I am opening the cursor like so:

> OPEN source_host;
> FETCH source_host INTO src_host;

So you already fetched the one row in the cursor.  FETCH ALL really
means "fetch all the rest of the rows", which is why it returns nothing.
The other variants you mention will reposition the cursor so they can
re-read the row.

> I absolutely need to have FETCH ALL working.

It is working.  What you're not doing correctly is repositioning the
cursor to before the first row.  Try MOVE BACKWARDS ALL.

            regards, tom lane

pgsql-general by date:

Previous
From: Eliot Gable
Date:
Subject: Performing FETCH ALL from a SCROLL CURSOR failing to return results
Next
From: John R Pierce
Date:
Subject: Re: Get the list of permissions/privileges on schema