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

Поиск
Список
Период
Сортировка
От Andrei Lepikhov
Тема Re: The const expression evaluation routine should always return a copy
Дата
Msg-id 95d6a074-e985-49c3-9796-3f759081f8ca@postgrespro.ru
обсуждение исходный текст
Ответ на Re: The const expression evaluation routine should always return a copy  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 28/2/2024 04:19, Tom Lane wrote:
> 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.
Thanks for the explanation. I was just such a developer of extensions 
who had looked into the internals of the eval_const_expressions, found a 
call for a '_mutator' function, and made such a mistake :).
I agree that freeing the return node value doesn't provide a sensible 
benefit because the underlying bushy tree was copied during mutation. 
What's more, it makes even less sense with the selectivity context 
coming shortly (I hope).

-- 
regards,
Andrei Lepikhov
Postgres Professional




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

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: Synchronizing slots from primary to standby
Следующее
От: Dilip Kumar
Дата:
Сообщение: Re: SLRU optimization - configurable buffer pool and partitioning the SLRU lock