Skip site navigation (1) Skip section navigation (2)

Re: [GENERAL] Fun with Cursors- how to rewind a cursor

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Postgres User" <postgres(dot)developer(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [GENERAL] Fun with Cursors- how to rewind a cursor
Date: 2007-03-02 07:06:49
Message-ID: 2689.1172819209@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-hackers
"Postgres User" <postgres(dot)developer(at)gmail(dot)com> writes:
> On 3/1/07, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> "Postgres User" <postgres(dot)developer(at)gmail(dot)com> writes:
>>> <before opening cursor>     ref_entry = 'c_entry';
>>> <after looping thru cursor>  MOVE Backward All In c_entry;
>> 
>> You have to use EXECUTE for the latter.

> I had tried several variations of MOVE Backward inside an Execute
> statement earlier.  And now, I'm seeing this error appear again:
> ERROR: 0A000: cannot manipulate cursors directly in PL/pgSQL

Hm, you're right.  This arises from the fact that _SPI_execute_plan
rejects cursor-related utility statements.  While I'd never stopped
to question that before, it does seem like this restriction is a
bit pointless.  Does anyone remember why it's like that?

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Tatsuo IshiiDate: 2007-03-02 07:11:42
Subject: Re: HOT - preliminary results
Previous:From: Pavan DeolaseeDate: 2007-03-02 07:01:00
Subject: Re: HOT - preliminary results

pgsql-general by date

Next:From: Richard HuxtonDate: 2007-03-02 07:53:45
Subject: Re: Differences in identical queries
Previous:From: Tom LaneDate: 2007-03-02 06:26:37
Subject: Re: How often do I need to reindex tables?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group