summaryrefslogtreecommitdiff
path: root/src/backend/executor/spi.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-05-21 22:05:55 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-05-21 22:05:55 +0000
commit959e61e917a802074e257d4bec13ee04ab4822ff (patch)
tree880e848a4b330587976ae3502164dc6e0c874ca4 /src/backend/executor/spi.c
parent0a2682445ebad57f911ed52f0634d1520164c319 (diff)
Remove global variable scanCommandId in favor of storing a command ID
in snapshots, per my proposal of a few days ago. Also, tweak heapam.c routines (heap_insert, heap_update, heap_delete, heap_mark4update) to be passed the command ID to use, instead of doing GetCurrentCommandID. For catalog updates they'll still get passed current command ID, but for updates generated from the main executor they'll get passed the command ID saved in the snapshot the query is using. This should fix some corner cases associated with functions and triggers that advance current command ID while an outer query is still in progress.
Diffstat (limited to 'src/backend/executor/spi.c')
-rw-r--r--src/backend/executor/spi.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index b9bcce30e29..9c445650e54 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.69 2002/04/15 05:22:04 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.70 2002/05/21 22:05:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -106,11 +106,7 @@ SPI_connect(void)
/* ... and switch to procedure's context */
_SPI_current->savedcxt = MemoryContextSwitchTo(_SPI_current->procCxt);
- _SPI_current->savedId = GetScanCommandId();
- SetScanCommandId(GetCurrentCommandId());
-
return SPI_OK_CONNECT;
-
}
int
@@ -129,8 +125,6 @@ SPI_finish(void)
MemoryContextDelete(_SPI_current->execCxt);
MemoryContextDelete(_SPI_current->procCxt);
- SetScanCommandId(_SPI_current->savedId);
-
/*
* After _SPI_begin_call _SPI_connected == _SPI_curid. Now we are
* closing connection to SPI and returning to upper Executor and so
@@ -1233,7 +1227,6 @@ _SPI_cursor_operation(Portal portal, bool forward, int count,
EState *estate;
MemoryContext oldcontext;
ScanDirection direction;
- CommandId savedId;
CommandDest olddest;
/* Check that the portal is valid */
@@ -1260,14 +1253,6 @@ _SPI_cursor_operation(Portal portal, bool forward, int count,
olddest = querydesc->dest;
querydesc->dest = dest;
- /*
- * Restore the scanCommandId that was current when the cursor was
- * opened. This ensures that we see the same tuples throughout the
- * execution of the cursor.
- */
- savedId = GetScanCommandId();
- SetScanCommandId(PortalGetCommandId(portal));
-
/* Run the executor like PerformPortalFetch and remember states */
if (forward)
{
@@ -1300,11 +1285,6 @@ _SPI_cursor_operation(Portal portal, bool forward, int count,
_SPI_current->processed = estate->es_processed;
- /*
- * Restore outer command ID.
- */
- SetScanCommandId(savedId);
-
/* Restore the old command destination and switch back to callers */
/* memory context */
querydesc->dest = olddest;