Re: Life cycles of tuple descriptors

Поиск
Список
Период
Сортировка
От Chapman Flack
Тема Re: Life cycles of tuple descriptors
Дата
Msg-id 61B94BC8.6090709@anastigmatix.net
обсуждение исходный текст
Ответ на Re: Life cycles of tuple descriptors  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Life cycles of tuple descriptors  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 12/14/21 20:02, Tom Lane wrote:
> 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.

I think what threw me was having a function whose API contract mentions
reference counts, but that sometimes gives me things that don't have them.

But I guess, making the between-the-lines of the contract explicit,
if lookup_rowtype_tupdesc is contracted to give me a tupdesc that sticks
around for as long as I haven't called ReleaseTupleDesc, and it sometimes
elects to give me one for which ReleaseTupleDesc is a no-op, the contract
is still that the thing sticks around for (at least) as long as I haven't
done that.

Cool. :)

Oh, hmm, maybe one thing in that API comment ought to be changed. It says
I must call ReleaseTupleDesc *or* DecrTupleDescRefCount. Maybe that dates
from before the shared registry? ReleaseTupleDesc is safe, but anybody who
uses DecrTupleDescRefCount on a lookup_rowtype_tupdesc result could be
in for an assertion failure if a non-refcounted tupdesc is returned.

Regards,
-Chap



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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Rewriting the test of pg_upgrade as a TAP test - take three - remastered set
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Life cycles of tuple descriptors