Solution

From: Jeff Davis <jeff95350(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Solution
Date: 2000-01-24 02:59:46
Message-ID: 20000124025946.19334.qmail@web3005.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Of course, here is the solution I used (to create a C
function to link to with PG):

'$' means done at command prompt
'=>' means done at psql prompt

this was done in Linux (RedHat 6.1) with PG 6.5 and
gcc

1) I made the C source file, file.c, which included
postgres.h

2) compiled as object:
$ gcc -fpic -c -o file.o file.c
$ ld -Bshareable -o file.so file.o

3) added function with SQL:
=> create function function_name(int4,float) returns
float AS '/path/to/file.so' language 'c';

4) test function with SQL:
=> select function_name(7,8.3) as number;

Hope this helps someone,
Jeff Davis

PS: If I get a good array function written (which I am
working on now) I will contribute that as well.
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

Browse pgsql-general by date

  From Date Subject
Next Message Lamar Owen 2000-01-24 03:20:03 Re: [GENERAL] RE: Where is the Database log file ?
Previous Message Marcin Mazurek - Multinet SA - Poznan 2000-01-24 02:37:39 Re: [GENERAL] It works now :)