public inbox for [email protected]
help / color / mirror / Atom feedFrom: Richard Guo <[email protected]>
To: Tom Lane <[email protected]>
Cc: [email protected]
Subject: Re: A modest proposal: make parser/rewriter/planner inputs read-only
Date: Tue, 15 Apr 2025 18:20:42 +0900
Message-ID: <CAMbWs4_9ozYZi4_s8DqVKDtOmYTmeRgQ0pZcZh1b4+3VxD8XXQ@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
On Sun, Apr 6, 2025 at 1:46 AM Tom Lane <[email protected]> wrote:
> The parser, rewriter, and planner all have a bad habit of scribbling
> on their input parsetrees. At this point I've lost count of how many
> bugs that's caused (but e33f2335a and 0f43083d1 are the two latest
> examples), and of how many places there are that are brute-forcing a
> solution to the problem by copying a whole parsetree before letting
> one of these subsystems see it.
>
> Years ago we fixed the executor to treat its input Plan trees as
> read-only. It seems like we really ought to do the same for these
> upstream subsystems. Surely, whatever benefit we get from changing
> Node contents in-place is lost due to all these other hacks.
While I'm in favor of this idea, it seems that it will require lots of
code changes. In particular, within the planner, the parsetree goes
through considerable transformations during the preprocessing phase,
such as subquery pull-up, constant folding, and so on. Would this
proposal mean we'd need to refactor all those places to treat the
input parsetrees as read-only? Just trying to understand the scope of
what would be involved.
Thanks
Richard
view thread (7+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: A modest proposal: make parser/rewriter/planner inputs read-only
In-Reply-To: <CAMbWs4_9ozYZi4_s8DqVKDtOmYTmeRgQ0pZcZh1b4+3VxD8XXQ@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox