From ae35363dced47a99178b4a4129e3ea1f990b829c Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Fri, 2 Oct 2009 17:58:21 +0000 Subject: 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/executor/spi.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/backend/executor') diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c index 40f43ee011b..3cffc2ad72b 100644 --- a/src/backend/executor/spi.c +++ b/src/backend/executor/spi.c @@ -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.208.2.1 2009/10/02 17:58:21 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 -- cgit v1.2.3