| Author |
Message |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 2 Sep 2010 14:33:43
|
Dave_Derry
New member
Joined: 2 Sep 2010 14:23:43
Messages: 3
Offline
|
I'm trying to get a feel for creating a function in C, but am encountering a problem. I'm working on Solaris, and according to 'pg_config --version' am working with a Postgres 8.1.18 database. 'pg_config --includedir' gives me /usr/include/pgsql.
If I set my -I flags to that directory and it server subdirectory I am able to compile a simple c file into a .so. However when I try to 'create or replace function' using that .so I get an error that it is missing a magic block. I tried to include:
#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif
in the .c file, but it didn't help. grep of that directory finds no files that contain PG_MODULE_MAGIC.
I did find /usr/postgres/8.2/include and /usr/postgres/8.3/include directories though, and tried compiling against them. Using 8.2, when I create the function I get an "incompatible library" magic block mismatch error. But if I compile against 8.3 the error states "Server: 8.2, Library: 8.3".
I am really at a loss how to resolve this problem. Can anyone recommend a solution?
Thanks,
Dave D
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 12 Sep 2010 08:25:45
|
Vibhor_K
Senior member
![[Avatar]](/images/avatar/6b1086f5fb6b725a975602564298d4b9.jpg)
Joined: 3 Jul 2009 09:46:15
Messages: 444
Offline
|
It's more like a incompatibility issue.
Please share the code. Let me see if I can make it workable for PG8.4.
|
Thanks & Regards,
Vibhor Kumar
Blog:http://vibhork.blogspot.com
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 15 Sep 2010 11:04:44
|
Dave_Derry
New member
Joined: 2 Sep 2010 14:23:43
Messages: 3
Offline
|
Yep, definitely a compatibility issue. I didn't mention that we aren't running on a raw PostGreSQL system, but are on Greenplum. With some more searching and experimenting I found that if I build against /usr/local/greenplum-db-3.3.6.1/include/postgresql I am able to create the function and execute it. Right now it doesn't do anything other than a simple select, but at least I now have managed to do that much.
Thanks,
Dave
|
|
|
 |
|
|