Re: lookup_rowtype_tupdesc considered harmful

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

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.

> One big strike against the reference-count approach is that it'd be
> difficult to back-patch such a solution into existing branches, since
> it would amount to an incompatible API change.

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.

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

-Neil

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-01-09 17:57:43 Re: lookup_rowtype_tupdesc considered harmful
Previous Message Tom Lane 2006-01-09 17:06:33 Re: plperl vs LC_COLLATE (was Re: Possible savepoint bug)