Re: lookup_rowtype_tupdesc considered harmful

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: lookup_rowtype_tupdesc considered harmful
Date: 2006-01-09 17:57:43
Message-ID: 6393.1136829463@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Neil Conway <neilc(at)samurai(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeremy Drake 2006-01-09 18:05:36 Re: catalog corruption bug
Previous Message Neil Conway 2006-01-09 17:17:25 Re: lookup_rowtype_tupdesc considered harmful