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.76 2004/12/31 22:02:48 pgsql Exp $
15+ * $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.77 2005/01/26 23:20:21 tgl Exp $
1616 *
1717 *-------------------------------------------------------------------------
1818 */
@@ -601,9 +601,11 @@ AtSubCommit_Portals(SubTransactionId mySubid,
601601/*
602602 * Subtransaction abort handling for portals.
603603 *
604- * Deactivatefailed portals created during the failed subtransaction.
604+ * Deactivate portals created during the failed subtransaction.
605605 * Note that per AtSubCommit_Portals, this will catch portals created
606606 * in descendants of the subtransaction too.
607+ *
608+ * We don't destroy any portals here; that's done in AtSubCleanup_Portals.
607609 */
608610void
609611AtSubAbort_Portals (SubTransactionId mySubid ,
@@ -628,21 +630,31 @@ AtSubAbort_Portals(SubTransactionId mySubid,
628630 * will go FAILED if the underlying cursor fails. (Note we do NOT
629631 * want to do this to upper-level portals, since they may be able
630632 * to continue.)
633+ *
634+ * This is only needed to dodge the sanity check in PortalDrop.
631635 */
632636if (portal -> status == PORTAL_ACTIVE )
633637portal -> status = PORTAL_FAILED ;
634638
635639/*
636640 * If the portal is READY then allow it to survive into the parent
637641 * transaction; otherwise shut it down.
642+ *
643+ * Currently, we can't actually support that because the portal's
644+ * query might refer to objects created or changed in the failed
645+ * subtransaction, leading to crashes if execution is resumed.
646+ * So, even READY portals are deleted. It would be nice to detect
647+ * whether the query actually depends on any such object, instead.
638648 */
649+ #ifdef NOT_USED
639650if (portal -> status == PORTAL_READY )
640651{
641652portal -> createSubid = parentSubid ;
642653if (portal -> resowner )
643654ResourceOwnerNewParent (portal -> resowner ,parentXactOwner );
644655}
645656else
657+ #endif
646658{
647659/* let portalcmds.c clean up the state it knows about */
648660if (PointerIsValid (portal -> cleanup ))