Re: missing PG_FREE_IF_COPY in textlike() and textnlike() ?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: missing PG_FREE_IF_COPY in textlike() and textnlike() ?
Дата
Msg-id 3588946.1663311801@sss.pgh.pa.us
обсуждение исходный текст
Ответ на missing PG_FREE_IF_COPY in textlike() and textnlike() ?  (CK Tan <cktan@vitessedata.com>)
Ответы Re: missing PG_FREE_IF_COPY in textlike() and textnlike() ?
Список pgsql-hackers
CK Tan <cktan@vitessedata.com> writes:
> I see in the texteq() function calls to DatumGetTextPP() are followed
> by conditional calls to PG_FREE_IF_COPY. e.g.

That's because texteq() is potentially usable as a btree index
function, and btree isn't too forgiving about leaks.

> However, in textlike(), PG_FREE_IF_COPY calls are missing.
> https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/like.c#L283

textlike() isn't a member of any btree opclass.

> Is this a memory leak bug?

Not unless you can demonstrate a case where it causes problems.
For the most part, such functions run in short-lived contexts.

            regards, tom lane



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

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: A question about wording in messages
Следующее
От: Zhang Mingli
Дата:
Сообщение: Re: Remove dead macro exec_subplan_get_plan