mirror of
https://github.com/postgres/postgres.git
synced 2025-06-27 23:21:58 +03:00
Update portal-related memory context names and API
Rename PortalMemory to TopPortalContext, to avoid confusion with PortalContext and align naming with similar top-level memory contexts. Rename PortalData's "heap" field to portalContext. The "heap" naming seems quite antiquated and confusing. Also get rid of the PortalGetHeapMemory() macro and access the field directly, which we do for other portal fields, so this abstraction doesn't buy anything. Reviewed-by: Andrew Dunstan <andrew.dunstan@2ndquadrant.com> Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>
This commit is contained in:
@ -1183,7 +1183,7 @@ SPI_cursor_open_internal(const char *name, SPIPlanPtr plan,
|
||||
}
|
||||
|
||||
/* Copy the plan's query string into the portal */
|
||||
query_string = MemoryContextStrdup(PortalGetHeapMemory(portal),
|
||||
query_string = MemoryContextStrdup(portal->portalContext,
|
||||
plansource->query_string);
|
||||
|
||||
/*
|
||||
@ -1213,7 +1213,7 @@ SPI_cursor_open_internal(const char *name, SPIPlanPtr plan,
|
||||
* will result in leaking our refcount on the plan, but it doesn't
|
||||
* matter because the plan is unsaved and hence transient anyway.
|
||||
*/
|
||||
oldcontext = MemoryContextSwitchTo(PortalGetHeapMemory(portal));
|
||||
oldcontext = MemoryContextSwitchTo(portal->portalContext);
|
||||
stmt_list = copyObject(stmt_list);
|
||||
MemoryContextSwitchTo(oldcontext);
|
||||
ReleaseCachedPlan(cplan, false);
|
||||
@ -1311,7 +1311,7 @@ SPI_cursor_open_internal(const char *name, SPIPlanPtr plan,
|
||||
*/
|
||||
if (paramLI)
|
||||
{
|
||||
oldcontext = MemoryContextSwitchTo(PortalGetHeapMemory(portal));
|
||||
oldcontext = MemoryContextSwitchTo(portal->portalContext);
|
||||
paramLI = copyParamList(paramLI);
|
||||
MemoryContextSwitchTo(oldcontext);
|
||||
}
|
||||
|
Reference in New Issue
Block a user