From: Chapman Flack <chap@anastigmatix.net>
To: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Life cycles of tuple descriptors
Date: Tue, 14 Dec 2021 15:42:12 -0500
Message-ID: <61B901A4.1050808@anastigmatix.net> (raw)
Hi,
There are some things about the life cycle of the common TupleDesc
that I'm not 100% sure about.
1. In general, if you get one from relcache or typcache, it is
reference-counted, right?
2. The only exception I know of is if you ask the typcache for
a blessed one (RECORD+typmod), and it is found in the shared-memory
cache. It is not refcounted then. If it is found only locally,
it is refcounted.
3. Is that shared case the only way you could see a non-refcounted
TupleDesc handed to you by the typcache?
4. How long can such a non-refcounted TupleDesc from the typcache
be counted on to live?
There is a comment in expandedrecord.c: "It it's not refcounted, just
assume it will outlive the expanded object."
That sounds like confidence, but is it confidence in the longevity
of shared TupleDescs, or in the fleeting lives of expanded records?
The same comment says "(This can happen for shared record types,
for instance.)" Does the "for instance" mean there are now, or just
in future might be, other cases where the typcache hands you
a non-refcounted TupleDesc?
5. When a constructed TupleDesc is blessed, the copy placed in the cache
by assign_record_type_typmod is born with a refcount of 1. Assuming every
later user of that TupleDesc plays nicely with balanced pin and release,
what event(s), if any, could ever occur to decrease that initial 1 to 0?
Thanks for any help getting these points straight!
Regards,
-Chap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: chap@anastigmatix.net
Subject: Re: Life cycles of tuple descriptors
In-Reply-To: <61B901A4.1050808@anastigmatix.net>
References: <61B901A4.1050808@anastigmatix.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox