parse error for function def

From: Terence Kearns <terencek(at)isd(dot)canberra(dot)edu(dot)au>
To: pgsql-sql(at)postgresql(dot)org
Subject: parse error for function def
Date: 2003-07-17 10:46:53
Message-ID: 3F167E9D.2090709@cts.canberra.edu.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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 to check reference
to views since pg does not support foreign keys referencing views.

--
Terence Kearns ~ ph: +61 2 6201 5516
IT Database/Applications Developer
Enterprise Information Systems
Client Services Division
University of Canberra
www.canberra.edu.au

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Gary Stainburn 2003-07-17 11:56:52 unique value - trigger?
Previous Message Terence Kearns 2003-07-17 08:39:21 Re: relevance