Short Desc: Cursor with hold emits the same row more than once across commits in 8.3.7
Os : Debian Etch amd64 / Ubuntu Jaunty amd64
Pg : 8.3.7
Build options: Official package and also compiled from source with --enable-integer-datetimes
Detailed Desc:

A construction of the form

DECLARE cur CURSOR WITH HOLD FOR SELECT * FROM obj

loop
   FETCH 1000 FROM cur
   process 'em
   COMMIT

results in some of the same rows being emitted more than once, altho the final rowcount is correct (i.e some rows end up being never seen).

Originally discovered using a perl DBI program, and we wondered if the version of DBD::Pg might be an issue, so a c library program was written to test this - and it exhibits the problem too (see attached for schema and program). The table rows are reasonably wide:


select attname,n_distinct,avg_width from pg_stats where tablename='obj';
  attname   | n_distinct | avg_width
-------------+------------+-----------
obj_id      |         -1 |         4
obj_link_id |          5 |         4
obj_fil     |      13035 |      1188

which may be a factor(tuplestore issues?)... The table is reasonably sizable (10000000 rows). I can attach the generation program for this dataset if required.

regards

Mark

Attachment: cursor-bug.tar.gz
Description: GNU Zip compressed data

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to