From: | Frédéric Yhuel <frederic(dot)yhuel(at)dalibo(dot)com> |
---|---|
To: | Sami Imseih <samimseih(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Benoit Lobréau <benoit(dot)lobreau(at)dalibo(dot)com>, Guillaume Lelarge <guillaume(dot)lelarge(at)dalibo(dot)com>, Pierrick Chovelon <pierrick(dot)chovelon(at)dalibo(dot)com> |
Subject: | Re: [BUG] temporary file usage report with extended protocol and unnamed portals |
Date: | 2025-04-21 05:46:50 |
Message-ID: | cad290a6-3d05-4060-823a-a6ac7504e1d9@dalibo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 4/20/25 00:42, Sami Imseih wrote:
>> (In my testing, the "temporary file:" message comes
>> out without any attached STATEMENT most of the time already, so this
>> isn't losing much as far as that's concerned.)
Indeed, this happens when using autocommit / implicit transactions.
But if you disable autocommit, and I think this is the most common
setting, we do have the attached statement.
> moreover, as I was looking into why the case mentioned earlier
>
> ```
> SELECT FROM foo ORDER BY a \bind
> ;
> SELECT 1 \bind
> ;
> ```
>
> does not show STATEMENT after the temp file logging, I realized
> it's because the temp files are cleaned up and reported at
> the end of transaction, which means that debug_query_string is NULL at the
> time the portal is dropped in the next query. This causes
> check_log_of_query to return false.
>
> /* query string available? */
> if (debug_query_string == NULL)
> return false;
>
Yes, we actually have two related bugs.
>> Perhaps a cleaner answer is to rearrange things in postgres.c
>> so that if there's a pre-existing unnamed portal, we drop that
>> before we ever set debug_query_string and friends at all.
> That did cross my mind as well, but I was trying to avoid doing this
> type of rearranging. I still rather not go down that path considering the
> case mentioned above will still not display the query text in a STATEMENT log.
IMHO, it would be nice to fix the explicit transactions case.
The bug with implicit transactions is less serious.
I can try to implement Tom's idea if we have a consensus.
Best regards,
Frédéric
From | Date | Subject | |
---|---|---|---|
Next Message | Fujii Masao | 2025-04-21 05:59:28 | Re: Align memory context level numbering in pg_log_backend_memory_contexts() |
Previous Message | David G. Johnston | 2025-04-21 04:13:47 | Re: Allow database owners to CREATE EVENT TRIGGER |