Re: Modify the DECLARE CURSOR command tag depending on the scrollable flag

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Michael Meskes <meskes(at)postgresql(dot)org>, Noah Misch <noah(at)leadboat(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
Subject: Re: Modify the DECLARE CURSOR command tag depending on the scrollable flag
Date: 2013-11-29 05:39:22
Message-ID: 5298288A.7050804@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2013-11-29 04:56 keltezéssel, Peter Eisentraut írta:
> On Wed, 2013-11-27 at 18:17 -0500, Tom Lane wrote:
>> Hm. So you're suggesting that ECPG fix this problem by inserting an
>> explicit NO SCROLL clause into translated DECLARE CURSOR commands, if
>> there's not a SCROLL clause?
> I wouldn't go that far yet.
>
> Do I understand this right that the future readahead code needs separate
> behavior depending on whether a cursor is scrollable?

The same code is used.

However, when the cursor is not scrollable, it returns an error early
to the application when it wants to go backward. It still allows
FETCH/MOVE ABSOLUTE to an earlier position just like the backend,
in which case scanning the cursor is restarted from the beginning.

If the cursor is not scrollable, the readahead code must not serve
tuples from the currently populated cache backward. If the cursor
is scrollable, FETCH BACKWARD is served from the cache.

> I would think
> that whatever you do with NO SCROLL cursors would also work with SCROLL
> cursors, so if you don't know what the cursor is, just use the code for
> NO SCROLL.
>
>
>
>

--
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de
http://www.postgresql.at/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2013-11-29 06:16:39 Re: logical changeset generation v6.7
Previous Message Robert Haas 2013-11-29 05:27:49 Re: Re: Suggestion: Issue warning when calling SET TRANSACTION outside transaction block