Ensure that a cursor has an immutable snapshot throughout its lifespan.
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 2 Oct 2009 17:57:30 +0000 (17:57 +0000)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 2 Oct 2009 17:57:30 +0000 (17:57 +0000)
commita8828c6e8e438bd482ed7936d9c8d29e1681e10b
tree4a2e352a8c9ce6c77f700ac1ff29a8bc657c24cd
parente777fd4ee111311f421a11825ba3c515cba1f95d
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