Neil Conway <neilc@samurai.com> writes:
> ... However, since we're primarily
> concerned with TupleDescs allocated in CacheMemoryContext and that
> context is never reset, we can use the reference count *just* to manage
> the "external" references to TupleDescs. That should make the patch far
> less invasive. (I have the feeling you've been suggesting this all
> along, I've just been too thick-skulled to understand you.)
Actually, what I've been thinking about is applying reference counting
only to the specific tupdescs that need it --- which at this point is
really only the ones in the typcache, though we might later extend the
use of the facility to other places. I suspect you'll find that it's
convenient to treat typcache's own link to a tupdesc as a reference
count too, so it's not strictly "external" references that should be
counted. The point is that we don't need to force all the code into
that same mold, especially not all at once.
> I'll hopefully have a patch implementing this finished by tomorrow
> evening.
OK. I'm going to go ahead and develop a non-refcount patch (copy
tupdescs where needed) to put into the back branches. I won't apply it
to HEAD unless you say so, though, as I'm sure it'd create a merge
problem for you.
regards, tom lane