Re: Life cycles of tuple descriptors

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Life cycles of tuple descriptors
Дата
Msg-id 602839.1639530148@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Life cycles of tuple descriptors  (Chapman Flack <chap@anastigmatix.net>)
Ответы Re: Life cycles of tuple descriptors  (Chapman Flack <chap@anastigmatix.net>)
Список pgsql-hackers
Chapman Flack <chap@anastigmatix.net> writes:
> But if I have gone straight to the typcache to ask for a RECORD tupdesc,
> and the one it gives me has -1 refcount, is it reasonable to assume
> I can retain a reference to that without the defensive copy?

The API contract for lookup_rowtype_tupdesc specifies that you must "call
ReleaseTupleDesc or DecrTupleDescRefCount when done using the tupdesc".
It's safe to assume that the tupdesc will stick around as long as you
haven't done that.

APIs that don't mention a refcount are handing you a tupdesc of uncertain
lifespan (no more than the current query, likely), so if you want the
tupdesc to last a long time you'd better copy it into storage you control.

            regards, tom lane



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

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: generalized conveyor belt storage
Следующее
От: Peter Smith
Дата:
Сообщение: Re: row filtering for logical replication