Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ...

Поиск
Список
Период
Сортировка
От VASUKI M
Тема Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ...
Дата
Msg-id CAE2r8H7h0gknvZHBcYJSzqC=DL3yZXfjfH3BvfnNbBxwh6dexg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ...  ("zengman" <zengman@halodbtech.com>)
Список pgsql-hackers

Hi zeng,

Thanks for pointing this out. You’re absolutely right — PQescapeLiteral() allocates memory using libpq’s allocator, so the returned buffers must be released with PQfreemem() rather than pfree(). Using pfree() here would be incorrect, since it expects memory allocated via PostgreSQL’s memory context APIs (palloc/psprintf).

I’ll update the patch to replace pfree() with PQfreemem() for the buffers returned by PQescapeLiteral(),while continuing to use pfree() for memory allocated via psprintf().

Thanks again for catching this.

Best regards,
Vasuki M
C-DAC,Chennai


On Mon, 22 Dec 2025, 8:18 pm zengman, <zengman@halodbtech.com> wrote:
Hi

I noticed that in the code, the variables `q_role` and `q_dbname` are processed with the `PQescapeLiteral` function,
so `PQfreemem` – instead of `pfree` – should be used here to free the memory.

--
Regards,
Man Zeng
www.openhalo.org

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