Use for name of unnamed portal's memory context
authorPeter Eisentraut
Tue, 8 Sep 2020 15:11:16 +0000 (17:11 +0200)
committerPeter Eisentraut
Tue, 8 Sep 2020 15:15:00 +0000 (17:15 +0200)
Otherwise just printing an empty string makes the memory context debug
output slightly confusing.

Discussion: https://www.postgresql.org/message-id/flat/ccb353ef-89ff-09b3-8046-1d2514624b9c%402ndquadrant.com

src/backend/utils/mmgr/portalmem.c

index 7072ce48a3ec88dcdee176f78160b96fb4c126de..ec6f80ee99b2ec13fbef5e55233d160bce1d2337 100644 (file)
@@ -220,8 +220,8 @@ CreatePortal(const char *name, bool allowDup, bool dupSilent)
    /* put portal in table (sets portal->name) */
    PortalHashTableInsert(portal, name);
 
-   /* reuse portal->name copy */
-   MemoryContextSetIdentifier(portal->portalContext, portal->name);
+   /* for named portals reuse portal->name copy */
+   MemoryContextSetIdentifier(portal->portalContext, portal->name[0] ? portal->name : "");
 
    return portal;
 }