Re: Custom Data Type Question

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Custom Data Type Question
Дата
Msg-id 19969.1163702606@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Custom Data Type Question  (Greg Mitchell <gmitchell@atdesk.com>)
Список pgsql-hackers
Greg Mitchell <gmitchell@atdesk.com> writes:
> As far as memory management goes, do I just use hash_create() and assign 
> that pointer to fn_extra and at the end of the query it will be freed? 
> Or will it not be freed until this end of the transaction? I'm really 
> having trouble understanding the memory management issues with Postgres.

You have to be careful that the hashtable is created in the correct
"memory context" --- in this case you want it to be in a query-lifespan
context, not the short-term (per-tuple-lifespan) context that your
function will be called in.  The usual procedure for cases like this is
to use the context identified by fn_mcxt.  src/backend/utils/mmgr/README
might make useful reading for you.
        regards, tom lane


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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: Custom Data Type Question
Следующее
От: "luis garcia"
Дата:
Сообщение: # of tuples on a Table?