Re: Trigger Problem

From: Andreas Joseph Krogh <andreak(at)officenet(dot)no>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Trigger Problem
Date: 2001-09-20 10:56:33
Message-ID: E15k1VR-0004v1-00@www.nettverk.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Mohammad Faisal <faisalchouhan(at)yahoo(dot)com> said:

> hey all
>
>
> I have created a function that is used in a trigger.
>
> --------------------------------------------------
> --------------------------------------------------
>
> CREATE TRIGGER tr_insert_on_a AFTER INSERT OR UPDATE
> ON A
> FOR EACH ROW EXECUTE PROCEDURE fn_insert_on_a();
>
> --------------------------------------------------
> --------------------------------------------------
>
> CREATE function fn_insert_on_a() RETURNS OPAQUE AS
> '
> BEGIN
> INSERT INTO B name, a_ref VALUES
> (NEW.name,NEW.id);
> RETURN NEW;
> END;
>
> ' LANGUAGE 'plpgsql';
>
>
> I am getting following error.
> ERROR :
>
> Unrecognized language specified in a CREATE FUNCTION:
> plpgsql. Recognized languages are sql,c,internal and
> the created procedure languages.
>
> NOTE:
>
> I have studied in documenatation that only plpgsql
> functions are written to be used in triggers.

You need to issue:
$ createlang plpgsql <db_name>
to create the plpgsql language on your database.

--
Andreas Joseph Krogh <andreak(at)officenet(dot)no>

Browse pgsql-sql by date

  From Date Subject
Next Message Haller Christoph 2001-09-20 11:11:14 Re: Selecting latest value
Previous Message David M. Richter 2001-09-20 10:34:08 table restruction