Andrei Lepikhov <lepihov@gmail.com> writes:
> But what is the way you are proposing here? Do you mean that one more
> entity will be explicitly introduced: a transformed parse tree?
No, I wasn't thinking of adding new concepts, just saying that the
inputs to certain operations need to be treated as read-only.
What would you envision a "transformed parse tree" being that's not
what we have today?
> It would open an opportunity for extensions to build a set of
> alternative transformed trees, pass them through the optimisation phase
> and choose the best plan.
Yeah, the ability to repeatedly operate on a tree without the overhead
of making copies would be a major benefit of being stricter here.
regards, tom lane