summaryrefslogtreecommitdiff
path: root/src/backend/utils/mmgr/portalmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/mmgr/portalmem.c')
-rw-r--r--src/backend/utils/mmgr/portalmem.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/utils/mmgr/portalmem.c b/src/backend/utils/mmgr/portalmem.c
index f3f0add1d6..75a6dde32b 100644
--- a/src/backend/utils/mmgr/portalmem.c
+++ b/src/backend/utils/mmgr/portalmem.c
@@ -22,6 +22,7 @@
#include "catalog/pg_type.h"
#include "commands/portalcmds.h"
#include "miscadmin.h"
+#include "storage/ipc.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
#include "utils/snapmgr.h"
@@ -758,6 +759,13 @@ AtAbort_Portals(void)
Portal portal = hentry->portal;
/*
+ * When elog(FATAL) is progress, we need to set the active portal to
+ * failed, so that PortalCleanup() doesn't run the executor shutdown.
+ */
+ if (portal->status == PORTAL_ACTIVE && shmem_exit_inprogress)
+ MarkPortalFailed(portal);
+
+ /*
* Do nothing else to cursors held over from a previous transaction.
*/
if (portal->createSubid == InvalidSubTransactionId)