[lug] C extensions of PostgreSQL

B Giles bldrbear at hotmail.com
Wed Aug 6 11:12:34 MDT 2003


At least take a look at the rest of the backend documentation.  I often 
found the answers I needed tucked away in some obscure corner.

And I know that they've done some amazing things with indexing... but user 
defined types still need to be able to define what to index on.

>From: "D. Stimits" <stimits at comcast.net>
>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:01:33 -0600
>
>B Giles wrote:
>
>>You don't link against pq, you link against the internal library.  I
>>haven't written user-defined functions or types since 7.1, but it's
>>probably something like pq-int.
>>
>>Backend programming is very different from the frontend, although it
>>might not be too bad if you're just writing a user-defined function.
>>User-defined types are a whole 'nother thing - you have to worry about
>>TOASTability, accessor functions if it's a composite object, possibly
>>type-specific indexing, etc.
>
>There are apparently some [optional] interface changes since 7.1. The 
>changes are supposed to give up on backwards compatibility at some future 
>release...for all I know 7.3 already does this, but I'm using PostgreSQL 
>from RH 7.3.
>
>My reference page is:
>http://www.postgresql.org/docs/7.2/interactive/xfunc-c.html
>
>I am not using any special user defined types, I am interested only in some 
>simple stuff that uses default types. The thing that reference page lacks 
>is information specific to what libraries must be linked. If you find on 
>the page the palloc() function, it is this function which must have an 
>implementation somewhere...I can #include the proper declaration, but I am 
>unable to figure out what library actually implements it. The libpq.so 
>library does not implement it. Using nm, I am unable to find a library with 
>the symbols required.
>
>I can see I am going to have to download the full source code and figure 
>out from their regression stuff what the heck I must link with, I really 
>hate downloading and building a new PostgreSQL just so I can see what the 
>link files are, but it looks like that is the only choice.
>
>D. Stimits, stimits AT comcast DOT net
>
>>
>>Bear
>>
>> > From: "D. Stimits"
>> > Reply-To: lug at lug.boulder.co.us
>> > To: BLUG
>> > Subject: [lug] C extensions of PostgreSQL
>> > Date: Wed, 06 Aug 2003 06:29:26 -0600
>> >
>> > I'm trying to write a C function for PostgreSQL on RH 7.3 (KRUD), and
>> > running into a problem. The C code must apparently link against a
>> > library that provides functions "CurrentMemoryContext" and
>> > "MemoryContextAlloc" (probably due to palloc). I've been digging
>> > around with nm and fail to find it. I'm currently linking as:
>> >   -lkrb5 -lk5crypto -lcom_err -lpq -ldl
>> >
>> > Can someone tell me what I am missing?
>> >
>> > D. Stimits, stimits AT comcast DOT net
>> >
>
>_______________________________________________
>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

_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail




More information about the LUG mailing list