* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.106.2.4 2010/07/05 09:27:31 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.106.2.5 2010/07/13 09:02:46 heikki Exp $
*
*-------------------------------------------------------------------------
*/
/*
* PinPortal
* Protect a portal from dropping.
+ *
+ * A pinned portal is still unpinned and dropped at transaction or
+ * subtransaction abort.
*/
void
PinPortal(Portal portal)
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);
}