Subject: C functions in POSTGRES

From: Carolyn Giberson <[email-masked]>
Date: Mon, 22 Jul 91 08:52:39 -0700

I'm trying to implement a C function (an example from the POSTGRES manual),
and am having no luck.  The scenario is as follows:

1.  The following function was written and compiled in C to yield f1.o:

    int f1()
    {
       extern long GetAttribute();
       long salary;

       salary = (long)GetAttribute("salary");
       return (salary > 50000);
    }

2.  I attempted to define the function in POSTGRES using commands like:

    define c function f1
    (file = "/home/grad/giber/post/f1.o", returntype = bool)
    arg(RELATION)

I get the message "syntax error at or near "(" ".

The relation the function will be working on has an attribute named
salary which is type int4.

I substituted int4 for returntype and for arg, with no success.

Can you spot my problem, or give me some advice on making and implementing
C functions?  (We have version 2.02 of POSTGRES.)

Thanks!

	Carolyn Giberson
	University of Georgia