1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-16 06:01:02 +03:00

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.
This commit is contained in:
Tom Lane
2002-05-21 22:05:55 +00:00
parent 0a2682445e
commit 959e61e917
37 changed files with 191 additions and 235 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/portalcmds.c,v 1.1 2002/04/15 05:22:03 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/portalcmds.c,v 1.2 2002/05/21 22:05:54 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -74,7 +74,6 @@ PerformPortalFetch(char *name,
EState *estate;
MemoryContext oldcontext;
ScanDirection direction;
CommandId savedId;
bool temp_desc = false;
/* initialize completion status in case of early exit */
@ -131,14 +130,6 @@ PerformPortalFetch(char *name,
temp_desc = true;
}
/*
* 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));
/*
* Determine which direction to go in, and check to see if we're
* already at the end of the available tuples in that direction. If
@ -185,11 +176,6 @@ PerformPortalFetch(char *name,
(dest == None) ? "MOVE" : "FETCH",
estate->es_processed);
/*
* Restore outer command ID.
*/
SetScanCommandId(savedId);
/*
* Clean up and switch back to old context.
*/