On Sun, 2006-01-15 at 12:08 -0500, Tom Lane wrote: > My inclination at this point is to forget the whole thing and just patch > the callers of lookup_rowtype_tupdesc that need to copy the tupdesc.
Actually, I think I finally understand how to implement this patch sanely. I had thought that the lifetime of a TupleDesc should be dictated by either the memory context in which it is allocated, OR its reference count. This leads us down the road toward mandatory reference counting, which I agree is a net loss. 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.) I'll hopefully have a patch implementing this finished by tomorrow evening. -Neil ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq