From: | Kostadin Zhelev <kostadin_m(at)yahoo(dot)com> |
---|---|
To: | pgsql-hackers-win32(at)postgresql(dot)org |
Subject: | Extending PostgreSQL on Windows |
Date: | 2005-06-30 14:47:55 |
Message-ID: | 20050630144755.53263.qmail@web30310.mail.mud.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers-win32 |
Hi I intalled postgreSQL 8.0.3 from win installer.
I am trying to create my own c functions to exetend the functionallity of postgres. I had some trouble so I tryed add_one function as it is shown in the documentation. When I use the old convention I am able to run the function fine when I use the new convention with the macros after i call the function I get the following error:
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
After playing with it a little I came if a conclusion that the arguments or the fcinfo struct is not properly initialized since the code breaks only when I try to access the arguments either through the macros or directly. My IDE is VS.NET 2003
The code that brakes is the following:
PG_FUNCTION_INFO_V1(add_one);
Datum
add_one(PG_FUNCTION_ARGS)
{
int32 arg = PG_GETARG_INT32(0);
PG_RETURN_INT32(arg);
}
But the following works:
Datum
add_one(PG_FUNCTION_ARGS)
{
FunctionCallInfo fcc;
fcc = (struct FunctionCallInfoData *)malloc(sizeof(struct FunctionCallInfoData));
fcc->nargs = 4;
return (int32)fcc->nargs;
}
Any help will be appreciated.
email:kostadin_m(at)yahoo(dot)com
---------------------------------
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2005-06-30 14:57:01 | Re: Extending PostgreSQL on Windows |
Previous Message | Tom Lane | 2005-06-23 14:45:30 | Re: R: R: How to move a DB from one server to another... |