Ensure that a cursor has an immutable snapshot throughout its lifespan.
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 2 Oct 2009 17:58:21 +0000 (17:58 +0000)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 2 Oct 2009 17:58:21 +0000 (17:58 +0000)
commitae35363dced47a99178b4a4129e3ea1f990b829c
treec0a113330d1b9039764b82a1e59820c420b6fe7a
parentd4bd8423c9939a30f0f29e70745917e4635b4973
Ensure that a cursor has an immutable snapshot throughout its lifespan.

The old coding was using a regular snapshot, referenced elsewhere, that was
subject to having its command counter updated.  Fix by creating a private copy
of the snapshot exclusively for the cursor.

Backpatch to 8.4, which is when the bug was introduced during the snapshot
management rewrite.
src/backend/commands/portalcmds.c
src/backend/executor/spi.c
src/backend/utils/time/snapmgr.c
src/include/utils/snapmgr.h
src/test/regress/expected/portals.out
src/test/regress/sql/portals.sql