Re: build array of composites in SPI

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: build array of composites in SPI
Date: 2009-11-17 19:55:48
Message-ID: b42b73150911171155u2134cdb4t2af6c3f5eb2ddc0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Nov 17, 2009 at 2:19 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Merlin Moncure <mmoncure(at)gmail(dot)com> writes:
>> right...makes sense.  converted.  one last question: can you save off
>> the blessed TupleDesc (that is, make it static) between invocations of
>> the function (I'm not worried about it changing)?
>
> You could probably get away with copying it into some long-term memory
> context.  Once you've blessed it the record typmod should remain the
> same for the rest of the session.
>
> If you're feeling bloody-minded you could remember the pointer returned
> by lookup_rowtype_tupdesc(), but that strikes me as assuming too much
> about the behavior of typcache.c.

Everything works! fantastic! Thanks again!

Just an idle thought:
Dealing with the backend api is always a little rough the first time
out. It's an awfully big job, but ISTM that the C language backend
api could use some expansion. Perhaps it could get it's own chapter,
with sections for SPI, Datums, triggers, composites, arrays, etc.
"34.8 C-Language Functions" is overlong and not very well organized
IMO. I certainly don't have time to work on ATM though.

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2009-11-17 20:13:46 Re: does encrypt function support higher than basic ascii?
Previous Message Tom Lane 2009-11-17 19:47:53 Re: Postgresql Database Lock Problem