Re: Fix unsafe PlannedStmt access in pg_stat_statements

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Chao Li <li.evan.chao@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, pgsql-hackers@lists.postgresql.org
Date: 2026-05-13T06:22:29Z
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. pg_stat_statements: Set PlannedStmt to NULL after nested utility execution

  2. pg_stat_statements: Fix potential use-after-free of PlannedStmt

  3. pg_stat_statements: Add counters for generic and custom plans

On Wed, May 13, 2026 at 01:31:01PM +0800, Chao Li wrote:
> Yeah, this is the exactly same change I was about to reply. And I
> agree the current comment is clear enough, no more needed to add.

Okay.  Let's just do that, then.
--
Michael