Commit 04cb9a6a authored by Tom Lane's avatar Tom Lane

Paranoia about data structure lifetime ...

parent 6779c55c
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/pquery.c,v 1.48 2002/02/27 19:35:16 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/tcop/pquery.c,v 1.49 2002/02/27 19:52:41 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -158,7 +158,6 @@ ProcessQuery(Query *parsetree, ...@@ -158,7 +158,6 @@ ProcessQuery(Query *parsetree,
if (parsetree->isPortal) if (parsetree->isPortal)
{ {
isRetrieveIntoPortal = true; isRetrieveIntoPortal = true;
intoName = parsetree->into;
/* If binary portal, switch to alternate output format */ /* If binary portal, switch to alternate output format */
if (dest == Remote && parsetree->isBinary) if (dest == Remote && parsetree->isBinary)
dest = RemoteInternal; dest = RemoteInternal;
...@@ -182,10 +181,12 @@ ProcessQuery(Query *parsetree, ...@@ -182,10 +181,12 @@ ProcessQuery(Query *parsetree,
*/ */
if (isRetrieveIntoPortal) if (isRetrieveIntoPortal)
{ {
intoName = parsetree->into;
portal = PreparePortal(intoName); portal = PreparePortal(intoName);
oldContext = MemoryContextSwitchTo(PortalGetHeapMemory(portal)); oldContext = MemoryContextSwitchTo(PortalGetHeapMemory(portal));
parsetree = copyObject(parsetree); parsetree = copyObject(parsetree);
plan = copyObject(plan); plan = copyObject(plan);
intoName = parsetree->into; /* use copied name in QueryDesc */
/* /*
* We stay in portal's memory context for now, so that query desc, * We stay in portal's memory context for now, so that query desc,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment