Re: FETCH FORWARD 0 and "cursor can only scan forward" error

From: Trigve <trigves(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: FETCH FORWARD 0 and "cursor can only scan forward" error
Date: 2013-09-05 05:21:12
Message-ID: loom.20130905T071803-926@post.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

David Johnston <polobo <at> yahoo.com> writes:

>
> Trigve Siver wrote
> > I want to iterate all records with cursor from beginning to end. This
> > sample could be rewritten using FETCH FORWARD 1 ... without using MOVE but
> > I'm interested with solution which throws error.
>
> Is you interest purely academic or is there some reason you were evaluating
> this particular combination of commands?

I was just using this command in some iterator code where I only fetched the
row on iterator dereferencing. So wanted to have solo operation for "move"
and for "fetch" command.

> I find the fact that the implementation detail behind "FORWARD 0" causing it
> to only be useful in a scroll-able cursor to be unusual but lacking any
> concrete use-cases as to why "FORWARD 0" is nominally useful - let alone in
> a scroll-forward-only situation - convincing someone to change the behavior
> is difficult.
> [...]
>
> Any comments on why it shouldn't work in a scroll-forward only situation.
> Re-returning the same row again may technically be considered "re-visiting
> the same record" which is what is being disallowed but if "0" is
> special-cased anyway it shouldn't be that difficult to return a cached
> result of whatever last came out of the cursor. Not sure its worth the time
> to code and test but is there some philosophical (or standards-based) reason
> such an action should be prohibited?

I agree with you and was asking the same question in mind when writing the
first message.

> David J.
>

Trigve

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2013-09-05 05:25:46 Re: Can you please suggest me some links where I can learn:
Previous Message M Tarkeshwar Rao 2013-09-05 05:13:19 Can you please suggest me some links where I can learn: