Skip site navigation (1) Skip section navigation (2)

Re: Trigger using function written in PL/PGSQL returns "Unrecognized language specified"

From: Dan B <db(at)cyclonehq(dot)dnsalias(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Trigger using function written in PL/PGSQL returns "Unrecognized language specified"
Date: 2001-02-10 05:57:16
Message-ID: 5.0.2.1.0.20010209215542.0291f3c8@10.0.0.254 (view raw or flat)
Thread:
Lists: pgsql-novice
Sorry, I forgot to mention:

[root(at)ds /root]# rpm -q -a | grep post
postgresql-devel-7.0.3-2
postgresql-jdbc-7.0.3-2
postgresql-tcl-7.0.3-2
postgresql-tk-7.0.3-2
postgresql-7.0.3-2
postgresql-odbc-7.0.3-2
postgresql-perl-7.0.3-2
postgresql-python-7.0.3-2
postgresql-server-7.0.3-2
postgresql-test-7.0.3-2
[root(at)ds /root]#


At 08:45 PM 2/9/2001 -0800, Dan B wrote:
>I am writing my first trigger & function.
>
>First question:
>---------------
>I can't get psql to take the function declaration.
>
>ds=# > CREATE FUNCTION trigger_insert_update_copay()
>ds-# RETURNS opaque
>
>ds-# RETURNS opaque AS 'BEGIN
>ds'# new.copay = (new.allowable * new.percent);
>ds'# RETURN new;
>ds'# END;'
>ds-# LANGUAGE 'plpgsql'
>ds-# Error: ERROR:  Unrecognized language specified in a CREATE FUNCTION: 
>'plpgsql'.  Recognized languages are sql, C, internal and the created 
>procedural languages.
>
>Here is my function:
>CREATE FUNCTION trigger_insert_update_copay()
>RETURNS opaque          -- should this be NUMERIC(??) or FLOAT4?
>AS 'BEGIN
>         new.copay = (new.allowable * new.percent);
>         RETURN new;
>END;'
>LANGUAGE 'plpgsql';
>
>Here is my Trigger:
>CREATE TRIGGER trigger_copay
>BEFORE INSERT
>ON coverage
>FOR EACH ROW
>EXECUTE PROCEDURE trigger_insert_update_copay();
>
>
>Second question:
>----------------
>It is supposed to multiply the 'allowable' and 'percent' field and leave 
>the result in 'copay'.  Is
>         new.copay = (new.allowable * new.percent);
>         RETURN new;
>The correct code to do that?
>
>
>Dan Browning, Cyclone Computer Systems, danb(at)cyclonecomputers(dot)com

Dan Browning, Cyclone Computer Systems, danb(at)cyclonecomputers(dot)com


In response to

pgsql-novice by date

Next:From: John JamesDate: 2001-02-10 12:51:18
Subject: Mac OS X Beta Status?
Previous:From: Dan BDate: 2001-02-10 04:45:50
Subject: Trigger using function written in PL/PGSQL returns "Unrecognized language specified"

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group