I found several issues with v4. It does not deal correctly with pipelining, and we should only really be concerned with dropping an unnamed portal only.
So, v5 now moves the DropPortal call after the unnamed portal was executed to completion ( as v4 was doing ), but does so only in the case in which we are not inside a transaction-control statement or the portal was executing a command that can be run inside a transaction block. Also, I realize that explicit cursors ( DECLARE CURSOR ) will only log temp file at cursor close and in which case, the statement associated with the temp file logging is the CLOSE command: i.e. ``` 2025-04-26 18:46:38.084 UTC [10415] LOG: temporary file: path "base/pgsql_tmp/pgsql_tmp10415.0", size 1014030336 2025-04-26 18:46:38.084 UTC [10415] STATEMENT: close mycursor_1; ``` I don't think there is much we can do there, or should we. -- Sami Imseih
v5-0001-Correct-timing-of-portal-drop-in-an-execute-messa.patch
Description: Binary data