diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2010-07-13 09:02:53 +0000 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2010-07-13 09:02:53 +0000 |
commit | 49d7a64f60425c56fa331e2fee99aa7967abc847 (patch) | |
tree | 8da9af2f6a99ebb8e5d6f81d0876944db0a9d34b | |
parent | 371a14255b24baa101f688a961b54e20b3ca6a17 (diff) | |
download | postgresql-49d7a64f60425c56fa331e2fee99aa7967abc847.tar.gz postgresql-49d7a64f60425c56fa331e2fee99aa7967abc847.zip |
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 be9cb3a52a1..a0c684f70e6 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.97.2.3 2010/07/05 09:27:36 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.97.2.4 2010/07/13 09:02:53 heikki Exp $ * *------------------------------------------------------------------------- */ @@ -322,6 +322,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) @@ -842,6 +845,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); } |