Fix binary cursors broken by MOVE implementation.

(Thanks to Bruce for finding what caused problem).
This commit is contained in:
Vadim B. Mikheev 1997-10-27 08:55:16 +00:00
parent f15eeff1bd
commit 110ba08a12
1 changed files with 20 additions and 9 deletions

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.19 1997/09/29 05:56:10 vadim Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.20 1997/10/27 08:55:16 vadim Exp $
* *
* NOTES * NOTES
* The PortalExecutorHeapMemory crap needs to be eliminated * The PortalExecutorHeapMemory crap needs to be eliminated
@ -97,10 +97,10 @@ PerformPortalFetch(char *name,
char *tag, char *tag,
CommandDest dest) CommandDest dest)
{ {
Portal portal; Portal portal;
int feature; int feature;
QueryDesc queryDesc; QueryDesc *queryDesc;
MemoryContext context; MemoryContext context;
/* ---------------- /* ----------------
* sanity checks * sanity checks
@ -147,11 +147,19 @@ PerformPortalFetch(char *name,
* tell the destination to prepare to recieve some tuples * tell the destination to prepare to recieve some tuples
* ---------------- * ----------------
*/ */
memcpy (&queryDesc, PortalGetQueryDesc(portal), sizeof (queryDesc)); queryDesc = PortalGetQueryDesc(portal);
queryDesc.dest = dest;
if ( dest == None ) /* MOVE */
{
QueryDesc *qdesc = (QueryDesc *) palloc (sizeof (QueryDesc));
memcpy (qdesc, queryDesc, sizeof (QueryDesc));
qdesc->dest = dest;
queryDesc = qdesc;
}
BeginCommand(name, BeginCommand(name,
queryDesc.operation, queryDesc->operation,
portal->attinfo, /* QueryDescGetTypeInfo(queryDesc), portal->attinfo, /* QueryDescGetTypeInfo(queryDesc),
* */ * */
false, /* portal fetches don't end up in false, /* portal fetches don't end up in
@ -168,8 +176,11 @@ PerformPortalFetch(char *name,
PortalExecutorHeapMemory = (MemoryContext) PortalExecutorHeapMemory = (MemoryContext)
PortalGetHeapMemory(portal); PortalGetHeapMemory(portal);
ExecutorRun(&queryDesc, PortalGetState(portal), feature, count); ExecutorRun(queryDesc, PortalGetState(portal), feature, count);
if ( dest == None ) /* MOVE */
pfree (queryDesc);
/* ---------------- /* ----------------
* Note: the "end-of-command" tag is returned by higher-level * Note: the "end-of-command" tag is returned by higher-level
* utility code * utility code