Re: lookup_rowtype_tupdesc considered harmful

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: lookup_rowtype_tupdesc considered harmful
Дата
Msg-id 6393.1136829463@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: lookup_rowtype_tupdesc considered harmful  (Neil Conway <neilc@samurai.com>)
Ответы Re: lookup_rowtype_tupdesc considered harmful  (Neil Conway <neilc@samurai.com>)
Список 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 по дате отправления:

Предыдущее
От: Neil Conway
Дата:
Сообщение: Re: lookup_rowtype_tupdesc considered harmful
Следующее
От: Jeremy Drake
Дата:
Сообщение: Re: catalog corruption bug