The following bug has been logged online:
Bug reference: 4553
Logged by: Andrew Gierth
Email address: andrew@tao11.riddles.org.uk
PostgreSQL version: 8.3-8.4
Operating system: all
Description: HOLD cursors not materializing results fully
Details:
(tested on 8.3.5 and HEAD as of a few weeks ago)
The materialization logic for holdable cursors isn't detoasting data prior
to storage in the portal's tuplestore, which leads to problems like this:
postgres=# create table test1 (a text);
CREATE TABLE
postgres=# insert into test1 values
(repeat('daafadslksdfalkeshfalkhfalsdjfhalsjdfhaldjfhalkfhd',10000));
INSERT 0 1
postgres=# declare testcur cursor with hold for select * from test1;
DECLARE CURSOR
postgres=# delete from test1;
DELETE 1
postgres=# vacuum
test1;
VACUUM
postgres=#
fetch first from testcur;
ERROR: missing chunk number 0 for toast value 65571 in pg_toast_65565
Obviously truncate, etc., is affected too.