diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2010-07-13 09:02:30 +0000 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2010-07-13 09:02:30 +0000 |
commit | 2751a249cbb314990642c67cf1ad7d638eac5911 (patch) | |
tree | b33b43f124e4f3452a8aa28a3015647247dbddd1 | |
parent | f0fd939655b0294f03317f142cc885dc13d5cb26 (diff) | |
download | postgresql-2751a249cbb314990642c67cf1ad7d638eac5911.tar.gz postgresql-2751a249cbb314990642c67cf1ad7d638eac5911.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 5dc60d9754f..852edd3f361 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.120 2010/07/06 19:18:59 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.121 2010/07/13 09:02:30 heikki Exp $ * *------------------------------------------------------------------------- */ @@ -379,6 +379,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) @@ -902,6 +905,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); } |