Re: Violation of principle that plan trees are read-only

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org, Andres Freund <andres@anarazel.de>
Date: 2025-05-19T14:35:26Z
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. In ExecInitModifyTable, don't scribble on the source plan.

  2. Rely on executor utils to build targetlist for DML RETURNING.

Robert Haas <robertmhaas@gmail.com> writes:
> On Sun, May 18, 2025 at 7:31 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> While chasing down Valgrind leakage reports, I was disturbed
>> to realize that some of them arise from a case where the
>> executor scribbles on the plan tree it's given, which it is
>> absolutely not supposed to do:

> Is there some way that we can detect violations of this rule
> automatically? I recall that we were recently discussing with Richard
> Guo a proposed patch that would have had a similar problem, so it's
> evidently not that hard for a committer to either fail to understand
> what the rule is or fail to realize that they are violating it.

I proposed a possible way to test for this at [1].  I was intending to
get around to that sooner or later, but the urgency of the matter just
went up in my eyes...

			regards, tom lane

[1] https://www.postgresql.org/message-id/flat/2531459.1743871597%40sss.pgh.pa.us