[lug] C extensions of PostgreSQL
D. Stimits
stimits at comcast.net
Wed Aug 6 14:35:13 MDT 2003
B Giles wrote:
> It can't be that simple if you need to palloc some memory!
It is. In the version 1 interface all variable length parameters (text,
varchar) must be passed by reference. All pass-by-reference are
allocated with palloc. I am passing a short varchar string (C type
VarChar). I would allocate with malloc, but this would either seg fault
or be a memory leak, since PostegreSQL wouldn't know to deallocate.
>
> Have you considered grabbing the source for the various contributed
> packages? It may be faster to see how other user-defined functions were
> written than to go through the PostgreSQL core software.
I just want to know what lib to link...the sample code I have is fine,
it is coded and complete...what I need is for a lib that implements
functionality for palloc (those symbols missing are because palloc
references them).
>
> Just say clear of user-defined types. My code worked (in 7.1), but it
> was scary. Lots and lots of nested macros.
I have only the existing types. Varchar is not custom.
D. Stimits, stimits AT comcast DOT net
>
>
> > From: "D. Stimits"
> > Reply-To: lug at lug.boulder.co.us
> > To: lug at lug.boulder.co.us
> > Subject: Re: [lug] C extensions of PostgreSQL
> > Date: Wed, 06 Aug 2003 11:31:11 -0600
> >
> > I plan to dig around, but I am not using any user defined types...only
> > the built-in types. I'm doing some simple integer bitwise manipulation
> > on ints.
>
>
> _________________________________________________________________
> The new MSN 8: smart spam protection and 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
> _______________________________________________
> Web Page: http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
>
More information about the LUG
mailing list