Re: lookup_rowtype_tupdesc considered harmful - Mailing list pgsql-hackers

From Tom Lane
Subject Re: lookup_rowtype_tupdesc considered harmful
Date
Msg-id 6393.1136829463@sss.pgh.pa.us
Whole thread Raw
In response to Re: lookup_rowtype_tupdesc considered harmful  (Neil Conway <neilc@samurai.com>)
Responses Re: lookup_rowtype_tupdesc considered harmful
List pgsql-hackers
Neil Conway <neilc@samurai.com> writes:
> On Sun, 2006-01-08 at 20:04 -0500, Tom Lane wrote:
>> On reflection I think that lookup_rowtype_tupdesc is simply misdesigned.
>> We can't have it handing back a pointer to a data structure of unspecified
>> lifetime.  One possibility is to give it an API comparable to the
>> syscache lookup functions, ie you get a reference-counted pointer that
>> you have to explicitly release when done with it.

> This seems a cleaner approach.

I have not been able to think of an efficient way to make it work while
still handing back a simple TupleDesc pointer --- seems like we'd have
to contort the API somehow so that the "release" function can find the
reference count.  Any thoughts about that?

> Perhaps adding a palloc() to lookup_rowtype_tupdesc() can be done for
> back branches (which should be minimally invasive), and a
> reference-counting API can be implemented for 8.2.

Agreed, it doesn't necessarily have to be the same solution in the back
branches.  OTOH I am still not convinced it's worth the trouble to
implement a reference-counting solution.

> I'd be happy to volunteer to do the refcounting changes, in the
> (probably unlikely :) ) event you'd rather not do the work yourself.

I've got plenty of stuff to do, will be happy to let you take up this
problem, if you have time to do something with it soon.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Neil Conway
Date:
Subject: Re: lookup_rowtype_tupdesc considered harmful
Next
From: Jeremy Drake
Date:
Subject: Re: catalog corruption bug