version 1 C-Language Functions

From: "Gowey, Geoffrey" <ggowey(at)rxhope(dot)com>
To: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: version 1 C-Language Functions
Date: 2001-08-25 20:05:30
Message-ID: E15F4B031E17D5118B18009027F67927DABE@SERVER
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I've been trying for days to figure this out, but just not have been able to
figure this out. I'm creating a test function for me to start out using the
v1 functions, but it fails.

I'm doing a simple function:

PG_FUNCTION_INFO_V1(testfunction)

Datum
testfunction(PG_FUNCTION_ARGS)
{
char *testb = PG_GETARG_CSTRING(0);
int tr;
tr = 1;
elog(NOTICE, "%s\n",testb);
PG_RETURN_INT16(tr);
}

I've declared it with "create function testfunction(text) returns int4 as
'....so' language 'c';"

and an trying to call it by "select testfunction('test(at)test(dot)com');"

Unfortunately, this function fails. What am i doing wrong? Also, the docs
behind v1 functions is sketchy and example code seems to be pretty much
nonexistent (everything in the contrib is V0). Where can I get further info
on writing sp's for pgsql in c? Thanks.

Geoff

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Lauko 2001-08-25 20:59:55 problems on solaris 7
Previous Message Aristeu Gil Alves Junior 2001-08-25 19:10:07 Backup of Blob