Subject: Problems defining functions

From: [email-masked]
Date: Tue, 30 Mar 93 07:51:28 -0800

We've been trying to define our own data types, but are having
problems defining functions. Following the instructions in the
Postgres User Manual, we are trying to define a function using the
following command :

* define C function double_in
(file="/u/davidw/postgres/tests/double.o", returntype=double_struct)
arg is (char16)
\g

This generates the following message:

Query sent to backend is "define C function double_in (file="/u/davidw/postgres/tests/double.o", returntype=double_struct) arg is (char16) "
WARN:Mar 30 16:45:27:parser: syntax error at or near "C"

We've tried different variations on the syntax, but with no success.
Could someone please tell us where we are going wrong. All help
appreciated.

Thanks, 

Sal.

--
Sally Cooper                                       [email-masked]
Fulcrum Communications Ltd, Fordrough Lane, Birmingham, B9 5LD, ENGLAND

---

From: George Hartzell <[email-masked]>
Date: Tue, 30 Mar 93 08:47:08 -0800

[email-masked] writes:
   >[...]

Check the man page for define_function, the sytax it lists is:

     define function function_name (
          language = {"c" | "postquel"},
          returntype = type-r
          [ , iscachable ]
          [ , percall_cpu = "costly{!*}" ]
          [ , perbyte_cpu = "costly{!*}" ]
          [ , outin_ratio =  percentage ]
          [ , byte_pct =  percentage ]
          )
         [ arg is ( type-1  { , type-n } ) ]
         as {"/full/path/to/objectfile" | "list-of-postquel-queries"}

This is for 4.1.

g.

---

From: Mike Olson <[email-masked]>
Date: Tue, 30 Mar 1993 10:43:08 -0800

> (file="/u/davidw/postgres/tests/double.o", returntype=double_struct)

you neglect to mention which version of postgres you're using.  in the
current version (4.1), the reference manual shows the correct syntax
for function definition:

	define function (language="c", returntyp=double_struct)
		arg is (char16) as "/u/davidw/postgres/tests/double.o"\g

					mike