everyone. I try to make simple example of how to create stored procedures in PostgreSQL written in C language. When compiling "test.c" there's an error "Unknown type Datum". I use Version 1 Calling convention. PostgreSQL 9.1 is installed on my server under Ubuntu 11.10. Please help. By the way does anybody have step-by-step example of creating stored procedures in C language? Thanks
2 Answers
I wrote up a mind dump while I was doing this awhile back on FreeBSD. Here is the link in case it might help.
1 Comment
geaden
Thank you, very much! I'll try as soon as get my pc
- Search for the postgres server includes path
(Debian Wheezy = /usr/include/postgresql/9.1/server/)
- Change
#includedirectives inside thePostgreSQLexample (foo.c) from#include ""to#include<> To compile, add the include search path with the directive
-I (gcc -fpic -c foo.c -I/usr/include/postgresql/9.1/server/)
Continue as its said in the Postgres documentation
#includea header file from the PostgreSQL implementation. Unfortunately, I don't know what that file would be.codecc -shared -o /usr/include/postgresql/foo.so /usr/include/postgresql/foo.o. cc: error: /usr/include/postgresql/foo.o: No such file or directory cc: fatal error: no input files compilation terminated. Thanks