Re: Partitioning option for COPY

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Partitioning option for COPY
Дата
Msg-id 28321.1258470219@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Partitioning option for COPY  (Emmanuel Cecchet <manu@asterdata.com>)
Ответы Re: Partitioning option for COPY
Список pgsql-hackers
Emmanuel Cecchet <manu@asterdata.com> writes:
> Tom Lane wrote:
>> This looks like the patch is trying to create a data structure in a
>> memory context that's not sufficiently long-lived for the use of the
>> structure.  If you do this in a non-cassert build, it will seem to
>> work, some of the time, if the memory in question happens to not
>> get reallocated to something else.
>> 
> I was using the CacheMemoryContext. Could someone tell me why this is 
> wrong and what should have been the appropriate context to use?

Well, (a) I doubt you really were creating the list in
CacheMemoryContext, else it'd have not gotten clobbered; (b) creating
statement-local data structures in CacheMemoryContext is entirely
unacceptable anyway, because then they represent a permanent memory
leak.

The right context for statement-lifetime data structures is generally
the CurrentMemoryContext the statement code is called with.
        regards, tom lane


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

Предыдущее
От: Emmanuel Cecchet
Дата:
Сообщение: Re: Partitioning option for COPY
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: actualised funcs typmod patch