From: | Rick Dearman <rdear(at)gameszone(dot)net> |
---|---|
To: | Postgresql general mailing list <pgsql-general(at)postgreSQL(dot)org> |
Subject: | User built functions? |
Date: | 1999-03-30 07:47:14 |
Message-ID: | 37008182.F0DE7087@gameszone.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I want to create a C funtion for my postgresql database which is passed
an int4 type and returns a string?
I attempted to do:
create function to_string(int4) returns varchar as 'to_stardate($1)'
language 'C';
and a function like this:
#include "executor/executor.h" /* for GetAttributeByName() */
#include <string.h>
#include <stdio.h>
#include "postgres.h" /* for char16, etc. */
#include "utils/palloc.h" /* for palloc */
#include "libpq-fe.h"
char *
#ifdef __STDC__
to_string (int integer_type, char *string)
#else /* __STDC__ */
to_string (interger_type)
int integer_type;
char *stardate;
#endif /* __STDC__ */
{
string = palloc(255);
sprintf( string, "[%d]", integer_type);
return string;
}
However this gives me an error like this:
ERROR: stat failed on file to_string($1)
I looked in my pg_language table and have
C listed under /bin/cc however the only compiler on my machine is in
/usr/local/bin/gcc could this be the problem?
From | Date | Subject | |
---|---|---|---|
Next Message | Herouth Maoz | 1999-03-30 11:51:16 | Re: [GENERAL] Returning an integer from a date |
Previous Message | pete collins | 1999-03-29 22:14:43 | Re: [GENERAL] backing up pgsql |