Re: pgsql: Drop unnamed portal immediately after execution to completion

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Sami Imseih <samimseih@gmail.com>
Cc: Mircea Cadariu <cadariu.mircea@gmail.com>, Robert Haas <robertmhaas@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Frédéric Yhuel <frederic.yhuel@dalibo.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-11-14T06:04:25Z
Lists: pgsql-hackers
On Thu, Nov 13, 2025 at 04:02:24PM -0600, Sami Imseih wrote:
> I am not sure I like this idea as-is, because besides that fact
> that it's still a wire level change, it's not safe at all to
> re-enter exec_execute_message after you just cleaned the
> portal but did not drop it.

This will come at the cost of tracking a new state in the backend
where the portal would still live with the executor state gone, I
don't like much my own plan D and the road where this leads at the
end.

> That is probably the best idea now.

I have just done a revert of 1fd981f05369 now, let's continue the
discussions.
--
Michael

Commits

  1. Add test for temporary file removal and WITH HOLD cursor

  2. Revert "Drop unnamed portal immediately after execution to completion"

  3. Drop unnamed portal immediately after execution to completion