Return-Path: pg_adm@postgres.berkeley.edu
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA15112; Mon, 22 Jul 91 08:52:39 -0700
Date: Mon, 22 Jul 91 08:52:39 -0700
Message-Id: <9107221552.AA15112@postgres.Berkeley.EDU>
From: Carolyn Giberson <giber@pollux.cs.uga.edu>
Subject: C functions in POSTGRES
To: postgres@postgres.berkeley.edu
Cc: giber@pollux.cs.uga.edu

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
