8787 elog(WARNING, "trying to delete portal name that does not exist"); \
8888} while(0)
8989
90- static MemoryContext PortalMemory = NULL ;
90+ static MemoryContext TopPortalContext = NULL ;
9191
9292
9393/* ----------------------------------------------------------------
@@ -104,10 +104,10 @@ EnablePortalManager(void)
104104{
105105 HASHCTL ctl ;
106106
107- Assert (PortalMemory == NULL );
107+ Assert (TopPortalContext == NULL );
108108
109- PortalMemory = AllocSetContextCreate (TopMemoryContext ,
110- "PortalMemory " ,
109+ TopPortalContext = AllocSetContextCreate (TopMemoryContext ,
110+ "TopPortalContext " ,
111111 ALLOCSET_DEFAULT_SIZES );
112112
113113 ctl .keysize = MAX_PORTALNAME_LEN ;
@@ -193,12 +193,12 @@ CreatePortal(const char *name, bool allowDup, bool dupSilent)
193193 }
194194
195195 /* make new portal structure */
196- portal = (Portal ) MemoryContextAllocZero (PortalMemory , sizeof * portal );
196+ portal = (Portal ) MemoryContextAllocZero (TopPortalContext , sizeof * portal );
197197
198- /* initialize portal heap context; typically it won't store much */
199- portal -> heap = AllocSetContextCreate (PortalMemory ,
200- "PortalHeapMemory " ,
201- ALLOCSET_SMALL_SIZES );
198+ /* initialize portal context; typically it won't store much */
199+ portal -> portalContext = AllocSetContextCreate (TopPortalContext ,
200+ "PortalContext " ,
201+ ALLOCSET_SMALL_SIZES );
202202
203203 /* create a resource owner for the portal */
204204 portal -> resowner = ResourceOwnerCreate (CurTransactionResourceOwner ,
@@ -263,7 +263,7 @@ CreateNewPortal(void)
263263 *
264264 * If cplan is NULL, then it is the caller's responsibility to ensure that
265265 * the passed plan trees have adequate lifetime. Typically this is done by
266- * copying them into the portal's heap context.
266+ * copying them into the portal's context.
267267 *
268268 * The caller is also responsible for ensuring that the passed prepStmtName
269269 * (if not NULL) and sourceText have adequate lifetime.
@@ -331,10 +331,10 @@ PortalCreateHoldStore(Portal portal)
331331
332332 /*
333333 * Create the memory context that is used for storage of the tuple set.
334- * Note this is NOT a child of the portal's heap memory .
334+ * Note this is NOT a child of the portal's portalContext .
335335 */
336336 portal -> holdContext =
337- AllocSetContextCreate (PortalMemory ,
337+ AllocSetContextCreate (TopPortalContext ,
338338 "PortalHoldContext" ,
339339 ALLOCSET_DEFAULT_SIZES );
340340
@@ -576,9 +576,9 @@ PortalDrop(Portal portal, bool isTopCommit)
576576 MemoryContextDelete (portal -> holdContext );
577577
578578 /* release subsidiary storage */
579- MemoryContextDelete (PortalGetHeapMemory ( portal ) );
579+ MemoryContextDelete (portal -> portalContext );
580580
581- /* release portal struct (it's in PortalMemory ) */
581+ /* release portal struct (it's in TopPortalContext ) */
582582 pfree (portal );
583583}
584584
@@ -806,7 +806,7 @@ AtAbort_Portals(void)
806806 * The cleanup hook was the last thing that might have needed data
807807 * there.
808808 */
809- MemoryContextDeleteChildren (PortalGetHeapMemory ( portal ) );
809+ MemoryContextDeleteChildren (portal -> portalContext );
810810 }
811811}
812812
@@ -1000,7 +1000,7 @@ AtSubAbort_Portals(SubTransactionId mySubid,
10001000 * The cleanup hook was the last thing that might have needed data
10011001 * there.
10021002 */
1003- MemoryContextDeleteChildren (PortalGetHeapMemory ( portal ) );
1003+ MemoryContextDeleteChildren (portal -> portalContext );
10041004 }
10051005}
10061006
0 commit comments