Remove PortalGetQueryDesc()
authorPeter Eisentraut <peter_e@gmx.net>
Sat, 16 Dec 2017 22:43:41 +0000 (17:43 -0500)
committerPeter Eisentraut <peter_e@gmx.net>
Tue, 9 Jan 2018 18:47:56 +0000 (13:47 -0500)
After having gotten rid of PortalGetHeapMemory(), there seems little
reason to keep one Portal access macro around that offers no actual
abstraction and isn't consistently used anyway.

Reviewed-by: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>
src/backend/commands/portalcmds.c
src/backend/executor/execCurrent.c
src/backend/tcop/pquery.c
src/include/utils/portal.h

index e977154689346e8aa6c34476ef961b1d822a63b6..6ecaea14433ceeafbacd3905f8c0c064e975dbca 100644 (file)
@@ -277,7 +277,7 @@ PortalCleanup(Portal portal)
     * since other mechanisms will take care of releasing executor resources,
     * and we can't be sure that ExecutorEnd itself wouldn't fail.
     */
-   queryDesc = PortalGetQueryDesc(portal);
+   queryDesc = portal->queryDesc;
    if (queryDesc)
    {
        /*
@@ -317,7 +317,7 @@ PortalCleanup(Portal portal)
 void
 PersistHoldablePortal(Portal portal)
 {
-   QueryDesc  *queryDesc = PortalGetQueryDesc(portal);
+   QueryDesc  *queryDesc = portal->queryDesc;
    Portal      saveActivePortal;
    ResourceOwner saveResourceOwner;
    MemoryContext savePortalContext;
index 6a8db582dba6d0ba91282a255e72732acd895208..ce7d4ac592af30020620df8e68bfca16f8f398b0 100644 (file)
@@ -75,7 +75,7 @@ execCurrentOf(CurrentOfExpr *cexpr,
                (errcode(ERRCODE_INVALID_CURSOR_STATE),
                 errmsg("cursor \"%s\" is not a SELECT query",
                        cursor_name)));
-   queryDesc = PortalGetQueryDesc(portal);
+   queryDesc = portal->queryDesc;
    if (queryDesc == NULL || queryDesc->estate == NULL)
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_CURSOR_STATE),
index 0420231864f76c5e84ef7946696e8f0d7f391bd4..66cc5c35c68ce49cf479239f4d54f5461b614809 100644 (file)
@@ -885,7 +885,7 @@ PortalRunSelect(Portal portal,
     * NB: queryDesc will be NULL if we are fetching from a held cursor or a
     * completed utility query; can't use it in that path.
     */
-   queryDesc = PortalGetQueryDesc(portal);
+   queryDesc = portal->queryDesc;
 
    /* Caller messed up if we have neither a ready query nor held data. */
    Assert(queryDesc || portal->holdStore);
@@ -1694,7 +1694,7 @@ DoPortalRewind(Portal portal)
    }
 
    /* Rewind executor, if active */
-   queryDesc = PortalGetQueryDesc(portal);
+   queryDesc = portal->queryDesc;
    if (queryDesc)
    {
        PushActiveSnapshot(queryDesc->snapshot);
index 8cedc0ea6021891c92375f273b81be9f7789860f..bc9d52e506eac7c8605a3a07bd9b5dddbf557b32 100644 (file)
@@ -198,11 +198,6 @@ typedef struct PortalData
  */
 #define PortalIsValid(p) PointerIsValid(p)
 
-/*
- * Access macros for Portal ... use these in preference to field access.
- */
-#define PortalGetQueryDesc(portal) ((portal)->queryDesc)
-
 
 /* Prototypes for functions in utils/mmgr/portalmem.c */
 extern void EnablePortalManager(void);