1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +03:00

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.
This commit is contained in:
Alvaro Herrera
2009-10-02 17:57:30 +00:00
parent fabf75cffc
commit caa4cfa369
6 changed files with 44 additions and 11 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.208 2009/06/11 14:48:57 momjian Exp $
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.209 2009/10/02 17:57:30 alvherre Exp $
*
*-------------------------------------------------------------------------
*/
@ -1211,10 +1211,7 @@ SPI_cursor_open_internal(const char *name, SPIPlanPtr plan,
}
}
/*
* Set up the snapshot to use. (PortalStart will do PushActiveSnapshot,
* so we skip that here.)
*/
/* Set up the snapshot to use. */
if (read_only)
snapshot = GetActiveSnapshot();
else