summaryrefslogtreecommitdiff
path: root/src/backend/commands/discard.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands/discard.c')
-rw-r--r--src/backend/commands/discard.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/commands/discard.c b/src/backend/commands/discard.c
index cc8ad9ae07..85a2ef8582 100644
--- a/src/backend/commands/discard.c
+++ b/src/backend/commands/discard.c
@@ -61,10 +61,11 @@ DiscardAll(bool isTopLevel)
*/
PreventTransactionChain(isTopLevel, "DISCARD ALL");
+ /* Closing portals might run user-defined code, so do that first. */
+ PortalHashTableDeleteAll();
SetPGVariable("session_authorization", NIL, false);
ResetAllOptions();
DropAllPreparedStatements();
- PortalHashTableDeleteAll();
Async_UnlistenAll();
LockReleaseAll(USER_LOCKMETHOD, true);
ResetPlanCache();