Memory contexts reset for trigger invocations

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Memory contexts reset for trigger invocations
Дата
Msg-id 20190204164417.5qgpxezxomycc6ja@alap3.anarazel.de
обсуждение исходный текст
Ответы Re: Memory contexts reset for trigger invocations  (Haribabu Kommi <kommi.haribabu@gmail.com>)
Re: Memory contexts reset for trigger invocations  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

trigger.c goes through some trouble to free the tuples returned by
trigger functions. There's plenty codepaths that look roughly like:
        if (oldtuple != newtuple && oldtuple != slottuple)
            heap_freetuple(oldtuple);
        if (newtuple == NULL)
        {
            if (trigtuple != fdw_trigtuple)
                heap_freetuple(trigtuple);
            return NULL;        /* "do nothing" */
        }

but we, as far as I can tell, do not reset the memory context in which
the trigger functions have been called.

Wouldn't it be better to reset an appropriate context after each
invocation? Yes, that'd require some care to manage the lifetime of
tuples returned by triggers, but that seems OK?

I get that most tables don't have dozens of triggers, but for more
complicated triggers/functions even a few seem like they'd matter?

Greetings,

Andres Freund


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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: propagating replica identity to partitions
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: propagating replica identity to partitions