version 1 C-Language Functions - Mailing list pgsql-general

From Gowey, Geoffrey
Subject version 1 C-Language Functions
Date
Msg-id E15F4B031E17D5118B18009027F67927DABE@SERVER
Whole thread Raw
Responses Re: version 1 C-Language Functions
List 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@test.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

pgsql-general by date:

Previous
From: "Aristeu Gil Alves Junior"
Date:
Subject: Backup of Blob
Next
From: Peter Lauko
Date:
Subject: problems on solaris 7