Re: TupleDesc refcounting - Mailing list pgsql-patches

From Neil Conway
Subject Re: TupleDesc refcounting
Date
Msg-id 1137481212.9145.102.camel@localhost.localdomain
Whole thread Raw
In response to Re: TupleDesc refcounting  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: TupleDesc refcounting
List pgsql-patches
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



pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: Re: patch to create system view that lists cursors
Next
From: Tom Lane
Date:
Subject: Re: TupleDesc refcounting