Re: The const expression evaluation routine should always return a copy

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: The const expression evaluation routine should always return a copy
Дата
Msg-id 2157387.1709068790@sss.pgh.pa.us
обсуждение исходный текст
Ответ на The const expression evaluation routine should always return a copy  (Andrei Lepikhov <a.lepikhov@postgrespro.ru>)
Ответы Re: The const expression evaluation routine should always return a copy  (Andrei Lepikhov <a.lepikhov@postgrespro.ru>)
Список pgsql-hackers
Andrei Lepikhov <a.lepikhov@postgrespro.ru> 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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Daniel Gustafsson
Дата:
Сообщение: Re: Remove --with-CC autoconf option
Следующее
От: Thomas Munro
Дата:
Сообщение: Re: Relation bulk write facility