Violation of principle that plan trees are read-only - Mailing list pgsql-hackers

From Tom Lane
Subject Violation of principle that plan trees are read-only
Date
Msg-id 213261.1747611093@sss.pgh.pa.us
Whole thread Raw
Responses Re: Violation of principle that plan trees are read-only
List pgsql-hackers
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:

        /*
         * Initialize result tuple slot and assign its rowtype using the first
         * RETURNING list.  We assume the rest will look the same.
         */
        mtstate->ps.plan->targetlist = (List *) linitial(returningLists);

A bit of git archaeology fingers Andres' commit 4717fdb14, which we
can't easily revert since he later got rid of ExecAssignResultType
altogether.  But I think we need to do something about it --- it's
purest luck that this doesn't cause serious problems in some cases.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: PG 17.2 compilation fails with -std=c11 on mac
Next
From: Robins Tharakan
Date:
Subject: Re: wrong query results on bf leafhopper