BUG #2970: "FETCH ABSOLUTE -1" from a holdable cursor failed

Started by William ZHANGabout 19 years ago2 messagesbugs
Jump to latest
#1William ZHANG
uniware@zedware.org

The following bug has been logged online:

Bug reference: 2970
Logged by: William ZHANG
Email address: uniware@zedware.org
PostgreSQL version: 8.2.2
Operating system: i686-pc-linux-gnu
Description: "FETCH ABSOLUTE -1" from a holdable cursor failed
Details:

DROP TABLE foo;
CREATE TABLE foo(fno INT);
INSERT INTO foo VALUES(generate_series(1,5));

BEGIN TRANSACTION;
DECLARE x SCROLL CURSOR WITH HOLD FOR SELECT fno FROM foo;
-- fetch all the 5 rows.
-- after that, cursor position should be past last row.
FETCH 10 FROM x;
COMMIT WORK;
-- try to fetch the last row.
-- it failed.
FETCH ABSOLUTE -1 FROM x;
CLOSE x;

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: William ZHANG (#1)
Re: BUG #2970: "FETCH ABSOLUTE -1" from a holdable cursor failed

"William ZHANG" <uniware@zedware.org> writes:

Description: "FETCH ABSOLUTE -1" from a holdable cursor failed

This bug seems to have been there since holdable cursors were first
implemented. Fixed for next releases --- thanks for the report!

regards, tom lane