Fix an error in the original coding of holdable cursors: PersistHoldablePortal

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 04dc48b5280bf692b4995ce9d4f80a5e75eb7074
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2007-02-06T22:49:30Z
Releases: 8.2.3
Fix an error in the original coding of holdable cursors: PersistHoldablePortal
thought that it didn't have to reposition the underlying tuplestore if the
portal is atEnd.  But this is not so, because tuplestores have separate read
and write cursors ... and the read cursor hasn't moved from the start.
This mistake explains bug #2970 from William Zhang.

Note: the coding here is pretty inefficient, but given that no one has noticed
this bug until now, I'd say hardly anyone uses the case where the cursor has
been advanced before being persisted.  So maybe it's not worth worrying about.

Files

PathChange+/−
src/backend/commands/portalcmds.c modified +12 −4