diff options
Diffstat (limited to 'src/backend/commands/command.c')
-rw-r--r-- | src/backend/commands/command.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/backend/commands/command.c b/src/backend/commands/command.c index 646511eb18d..9b1a33673c7 100644 --- a/src/backend/commands/command.c +++ b/src/backend/commands/command.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.152 2002/01/03 23:19:30 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.153 2002/02/14 15:24:06 tgl Exp $ * * NOTES * The PerformAddAttribute() code, like most of the relation @@ -103,6 +103,7 @@ PerformPortalFetch(char *name, QueryDesc *queryDesc; EState *estate; MemoryContext oldcontext; + CommandId savedId; bool temp_desc = false; /* @@ -156,7 +157,7 @@ PerformPortalFetch(char *name, } /* - * tell the destination to prepare to receive some tuples. + * Tell the destination to prepare to receive some tuples. */ BeginCommand(name, queryDesc->operation, @@ -169,6 +170,14 @@ PerformPortalFetch(char *name, queryDesc->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)); + + /* * 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 * so, do nothing. (This check exists because not all plan node types @@ -215,6 +224,11 @@ PerformPortalFetch(char *name, } /* + * Restore outer command ID. + */ + SetScanCommandId(savedId); + + /* * Clean up and switch back to old context. */ if (temp_desc) |