Skip to content

Commit 2751a24

Browse files
committed
Oops, in the previous fix to prevent a cursor that's being used in a FOR
loop from being dropped, I missed subtransaction cleanup. Pinned portals must be dropped at subtransaction cleanup just as they are at main transaction cleanup. Per bug #5556 by Robert Walker. Backpatch to 8.0, 7.4 didn't have subtransactions.
1 parent f0fd939 commit 2751a24

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/backend/utils/mmgr/portalmem.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1994, Regents of the University of California
1313
*
1414
* IDENTIFICATION
15-
* $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.120 2010/07/06 19:18:59 momjian Exp $
15+
* $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.121 2010/07/13 09:02:30 heikki Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -379,6 +379,9 @@ PortalCreateHoldStore(Portal portal)
379379
/*
380380
* PinPortal
381381
* Protect a portal from dropping.
382+
*
383+
* A pinned portal is still unpinned and dropped at transaction or
384+
* subtransaction abort.
382385
*/
383386
void
384387
PinPortal(Portal portal)
@@ -902,6 +905,14 @@ AtSubCleanup_Portals(SubTransactionId mySubid)
902905
if (portal->createSubid != mySubid)
903906
continue;
904907

908+
/*
909+
* If a portal is still pinned, forcibly unpin it. PortalDrop will not
910+
* let us drop the portal otherwise. Whoever pinned the portal was
911+
* interrupted by the abort too and won't try to use it anymore.
912+
*/
913+
if (portal->portalPinned)
914+
portal->portalPinned = false;
915+
905916
/* Zap it. */
906917
PortalDrop(portal, false);
907918
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy