The purpose of the function is to take a string and, if it contains parens, delete everything in the parens. Here's what I have:
CREATE FUNCTION clearmethodparams(IN qname text) RETURNS text AS
$BODY$
IF position($o$($o$ in qname) = 0 THEN
return qname;
ELSE
return substring(qname from 0 for position($p$($p$ in qname)) || $c$)$c$;
END IF;
$BODY$
LANGUAGE sql VOLATILE;
The error it keeps giving me is
ERROR: syntax error at or near "IF" LINE 3: IF position($o$($o$ in qname) = 0 THEN
I've been trying to find some good documentation on function syntax, but nothing so far has been helpful.