diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2017-12-16 17:26:26 -0500 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2018-01-09 13:47:56 -0500 |
commit | 0f7c49e85518dd846ccd0a044d49a922b9132983 (patch) | |
tree | 1bcbff190de4cc6f8c02e3ecbb2e9b753bbb1ef5 /src/backend/tcop/pquery.c | |
parent | 3cb1b2a8804da8365fe17f687d96b720df4a583d (diff) | |
download | postgresql-0f7c49e85518dd846ccd0a044d49a922b9132983.tar.gz postgresql-0f7c49e85518dd846ccd0a044d49a922b9132983.zip |
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>
Diffstat (limited to 'src/backend/tcop/pquery.c')
-rw-r--r-- | src/backend/tcop/pquery.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/tcop/pquery.c b/src/backend/tcop/pquery.c index 9925712768f..0420231864f 100644 --- a/src/backend/tcop/pquery.c +++ b/src/backend/tcop/pquery.c @@ -466,9 +466,9 @@ PortalStart(Portal portal, ParamListInfo params, ActivePortal = portal; if (portal->resowner) CurrentResourceOwner = portal->resowner; - PortalContext = PortalGetHeapMemory(portal); + PortalContext = portal->portalContext; - oldContext = MemoryContextSwitchTo(PortalGetHeapMemory(portal)); + oldContext = MemoryContextSwitchTo(PortalContext); /* Must remember portal param list, if any */ portal->portalParams = params; @@ -634,7 +634,7 @@ PortalSetResultFormat(Portal portal, int nFormats, int16 *formats) return; natts = portal->tupDesc->natts; portal->formats = (int16 *) - MemoryContextAlloc(PortalGetHeapMemory(portal), + MemoryContextAlloc(portal->portalContext, natts * sizeof(int16)); if (nFormats > 1) { @@ -748,7 +748,7 @@ PortalRun(Portal portal, long count, bool isTopLevel, bool run_once, ActivePortal = portal; if (portal->resowner) CurrentResourceOwner = portal->resowner; - PortalContext = PortalGetHeapMemory(portal); + PortalContext = portal->portalContext; MemoryContextSwitchTo(PortalContext); @@ -1184,7 +1184,7 @@ PortalRunUtility(Portal portal, PlannedStmt *pstmt, completionTag); /* Some utility statements may change context on us */ - MemoryContextSwitchTo(PortalGetHeapMemory(portal)); + MemoryContextSwitchTo(portal->portalContext); /* * Some utility commands may pop the ActiveSnapshot stack from under us, @@ -1343,9 +1343,9 @@ PortalRunMulti(Portal portal, /* * Clear subsidiary contexts to recover temporary memory. */ - Assert(PortalGetHeapMemory(portal) == CurrentMemoryContext); + Assert(portal->portalContext == CurrentMemoryContext); - MemoryContextDeleteChildren(PortalGetHeapMemory(portal)); + MemoryContextDeleteChildren(portal->portalContext); } /* Pop the snapshot if we pushed one. */ @@ -1424,7 +1424,7 @@ PortalRunFetch(Portal portal, ActivePortal = portal; if (portal->resowner) CurrentResourceOwner = portal->resowner; - PortalContext = PortalGetHeapMemory(portal); + PortalContext = portal->portalContext; oldContext = MemoryContextSwitchTo(PortalContext); |