public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Andrei Lepikhov <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: The const expression evaluation routine should always return a copy
Date: Tue, 27 Feb 2024 16:19:50 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
Andrei Lepikhov <[email protected]> writes:
> IMO, the routine eval_const_expressions_mutator contains some stale code:
I'd like to push back against the idea that eval_const_expressions
is expected to return a freshly-copied tree. Its API specification
contains no such claim. It's true that it appears to do that
everywhere but here, but I think that's an implementation detail
that callers had better not depend on. It's not hard to imagine
someone trying to improve its performance by avoiding unnecessary
copying.
Also, your proposed patch introduces a great deal of schizophrenia,
because SubPlan has substructure. What's the point of making a copy
of the SubPlan node itself, if the testexpr and args aren't copied?
But we shouldn't modify those, because as the comment states, it's
a bit late to be doing so.
I agree that the comment claiming we can't get here is outdated,
but I'm unexcited about changing the code's behavior.
regards, tom lane
view thread (3+ messages)
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: The const expression evaluation routine should always return a copy
In-Reply-To: <[email protected]>
* 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