Trouble with CREATE FUNCTION

From: S Bey <iszsb(at)comp(dot)leeds(dot)ac(dot)uk>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Trouble with CREATE FUNCTION
Date: 2001-02-18 17:14:32
Message-ID: Pine.LNX.4.30.0102162021570.17254-100000@cslin050
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Dear All,

I have tried creating a function as follows:

CREATE FUNCTION chkTelephone () RETURNS OPAQUE AS '
BEGIN
IF EXISTS (SELECT *
FROM tenant t
WHERE t.areacode = NEW.areacode AND
t.telephone = NEW.telphone) THEN
RAISE EXCEPTION ''THAT TELEPHONE NUMBER ALREADY EXISTS!'';
END IF;
RETURN NEW;
END;
' LANGUAGE 'plpgsql';

However I get the following error:

ERROR: Unrecognized language specified in a CREATE FUNCTION: 'plpgsql'.
Recognized languages are sql, C, internal and the created procedural
languages.

In the documentation it states that 'PL/pgSQL is a loadable procedural
language for the Postgres database system.'. Where can I load it from and
are there any other problems that may arise?

Cheers, Steve.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Kevin Quinlan 2001-02-18 20:42:43 Speed of SQL statements
Previous Message Alexaki Sofia 2001-02-18 12:52:50 speed up creation of a table