[SQL] parse error for function def

2003-07-17 Thread Terence Kearns
CREATE FUNCTION base.fn_fkey_check(text, text, int4) RETURNS bool AS 'DECLARE BEGIN RETURN (SELECT count($1) FROM $2 where $1 = $3)::bool; END;' LANGUAGE 'sql'; produces this error ERROR: parser: parse error at or near "RETURN" at character 20 I'm trying to create a function to use on a trigger

Re: [SQL] parse error for function def

2003-07-17 Thread greg
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > I'm trying to create a function to use on a trigger to check reference > to views since pg does not support foreign keys referencing views. Can you explain exactly what you are trying to do and why? You are getting the error because a SQL functi

Re: [SQL] parse error for function def

2003-07-17 Thread Dmitry Tkach
Terence Kearns wrote: CREATE FUNCTION base.fn_fkey_check(text, text, int4) RETURNS bool AS 'DECLARE BEGIN RETURN (SELECT count($1) FROM $2 where $1 = $3)::bool; END;' LANGUAGE 'sql'; produces this error ERROR: parser: parse error at or near "RETURN" at character 20 I'm trying to create a functi

Re: [SQL] parse error for function def

2003-07-17 Thread Stephan Szabo
On Thu, 17 Jul 2003, Terence Kearns wrote: > CREATE FUNCTION base.fn_fkey_check(text, text, int4) RETURNS bool AS > 'DECLARE > BEGIN >RETURN (SELECT count($1) FROM $2 where $1 = $3)::bool; > END;' > LANGUAGE 'sql'; > > produces this error > ERROR: parser: parse error at or near "RETURN" at c

Re: [SQL] parse error for function def

2003-07-17 Thread Jonathan Gardner
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thursday 17 July 2003 03:46, Terence Kearns wrote: > CREATE FUNCTION base.fn_fkey_check(text, text, int4) RETURNS bool AS > 'DECLARE > BEGIN >RETURN (SELECT count($1) FROM $2 where $1 = $3)::bool; > END;' > LANGUAGE 'sql'; > > produces this erro