summaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r--src/backend/tcop/postgres.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 7dd75a490aa..2bd89102686 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -2327,6 +2327,16 @@ exec_execute_message(const char *portal_name, long max_rows)
* message. The next protocol message will start a fresh timeout.
*/
disable_statement_timeout();
+
+ /*
+ * We completed fetching from an unnamed portal. There is no need
+ * for it beyond this point, so drop it now rather than wait for
+ * the next Bind message to do this cleanup. This ensures that
+ * the correct statement is logged when cleaning up temporary file
+ * usage.
+ */
+ if (portal->name[0] == '\0')
+ PortalDrop(portal, false);
}
/* Send appropriate CommandComplete to client */