Re: [BUG] temporary file usage report with extended protocol and unnamed portals - Mailing list pgsql-hackers

From Sami Imseih
Subject Re: [BUG] temporary file usage report with extended protocol and unnamed portals
Date
Msg-id CAA5RZ0vB-h2pFimPSi72ObWfpRwKR5kaN9XWW17TOkLntC9svA@mail.gmail.com
Whole thread Raw
In response to Re: [BUG] temporary file usage report with extended protocol and unnamed portals  (Michael Paquier <michael@paquier.xyz>)
Responses Re: [BUG] temporary file usage report with extended protocol and unnamed portals
List pgsql-hackers
> Now, if I apply patch v11-0002 that only adds the tests but not
> v11-0001, the tests pass.

Ok. It looks like my regexp was wrong. v12-0002 fixes this by looking
for the correct STATEMENT: after the temp file logging.
I also realized that the initial tests we've been working with included:

```
+log_statement = all
+log_min_duration_statement = 0
```

which caused additional noise and did not isolate the temp logging,
and that could mislead the tests. So, I removed these settings.
So now, applied independently, the tests in 0002 will not pass.

I also went back to think about the concern by Tom early in the thread [0]
that "The portal's query string is potentially shorter-lived than the portal."

I don't think this is a concern since the query string passed to the Portal
will outlive the portal, per this comment right before PortalDefineQuery:

```
/*
* We don't have to copy anything into the portal, because everything
* we are passing here is in MessageContext or the
* per_parsetree_context, and so will outlive the portal anyway.
*/
```

The "everything" also includes the query_text.

So, v12-0001 now sets debug_query_string before PortalDrop ( inside
drop_unnamed_portal). We will now with only log_temp_files set to "on",
see the "LOG: temporary file:" followed by the correctly blamed query
in the " STATEMENT: ".

[0] https://www.postgresql.org/message-id/23969.1745083695%40sss.pgh.pa.us

--
Sami

Attachment

pgsql-hackers by date:

Previous
From: Corey Huinker
Date:
Subject: Re: someone else to do the list of acknowledgments
Next
From: "Jonathan S. Katz"
Date:
Subject: Re: PG 18 relnotes and RC1