Re: Fix unsafe PlannedStmt access in pg_stat_statements

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Fix unsafe PlannedStmt access in pg_stat_statements
Date: 2026-05-13 05:31:01
Message-ID: A90FA5E9-ECB2-4AF7-B487-EA9C89B04091@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On May 13, 2026, at 12:26, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Tue, May 12, 2026 at 11:00:16AM +0200, Andres Freund wrote:
>> Seems like the code should make this clearer, by simply unsetting
>> pstmt at the point it becomes unsafe to use?
>
> Sure, we could do that as well and crash hard if something decides to
> do the same mistake. Like the simple patch attached for example? I
> am not sure if we need to update the comment. It's pretty clear what
> the intention is, at least to me.
> --
> Michael
> <pgss-pstmt.patch>

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.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhenwei Shang 2026-05-13 05:49:31 Re: [PATCH] psql: Add missing IO option to EXPLAIN tab completion
Previous Message Ashutosh Bapat 2026-05-13 05:27:13 Re: [Bug] Add the missing RTE_GRAPH_TABLE case to transformLockingClause()