Re: RFC: Logging plan of the running query

Akshat Jaimini <destrex271@gmail.com>

From: Akshat Jaimini <destrex271@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Cc: Atsushi Torikoshi <torikoshia@oss.nttdata.com>
Date: 2025-11-18T20:19:46Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. ecpg: Catch zero-length Unicode identifiers correctly

  2. Improve warning message in pg_signal_backend()

  3. Add assert to ensure that page locks don't participate in deadlock cycle.

Hi,
I have a question:

In src/backend/executor/execMain.c:

```
+	SetCurrentQueryDesc(oldQueryDesc);
+
+	/*
+	 * Ensure LogQueryPlanPending is initialized in case there was no time for
+	 * logging the plan. Othewise plan will be logged at the next query
+	 * execution on the same session.
+	 */
+	LogQueryPlanPending = false;
```

It would be really helpful if you could elaborate on any cases where this specific situation might arise i.e. where 'there was no time for logging the plan'. Are we referencing to something like a sudden shutdown of the postmaster process or is this referring to something else entirely?

Regards,
Akshat Jaimini