diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index dc4c600922df..8c537dfca881 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -2323,6 +2323,10 @@ exec_execute_message(const char *portal_name, long max_rows) * message. The next protocol message will start a fresh timeout. */ disable_statement_timeout(); + + /* unnamed portal executed to completion, so close it */ + if (portal_name[0] == '\0') + PortalDrop(portal, false); } /* Send appropriate CommandComplete to client */