diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2010-07-13 09:03:11 +0000 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2010-07-13 09:03:11 +0000 |
commit | b2396701733f72a94f011198fa0855d621fd5ffa (patch) | |
tree | 497aa173f8ff35c9f7c3ed13e2c3192fac9de818 | |
parent | b8accd651219de90968aa0900fe95ac04cda007c (diff) | |
download | postgresql-b2396701733f72a94f011198fa0855d621fd5ffa.tar.gz |
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.
-rw-r--r-- | src/backend/utils/mmgr/portalmem.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/backend/utils/mmgr/portalmem.c b/src/backend/utils/mmgr/portalmem.c index bb8931c8a7..d7d11d7730 100644 --- a/src/backend/utils/mmgr/portalmem.c +++ b/src/backend/utils/mmgr/portalmem.c @@ -12,7 +12,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.76.4.3 2010/07/05 09:27:49 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.76.4.4 2010/07/13 09:03:11 heikki Exp $ * *------------------------------------------------------------------------- */ @@ -298,6 +298,9 @@ PortalCreateHoldStore(Portal portal) /* * PinPortal * Protect a portal from dropping. + * + * A pinned portal is still unpinned and dropped at transaction or + * subtransaction abort. */ void PinPortal(Portal portal) @@ -764,6 +767,14 @@ AtSubCleanup_Portals(SubTransactionId mySubid) if (portal->createSubid != mySubid) continue; + /* + * If a portal is still pinned, forcibly unpin it. PortalDrop will not + * let us drop the portal otherwise. Whoever pinned the portal was + * interrupted by the abort too and won't try to use it anymore. + */ + if (portal->portalPinned) + portal->portalPinned = false; + /* Zap it. */ PortalDrop(portal, false); } |