Trigger using function written in PL/PGSQL returns "Unrecognized language specified"
От | Dan B |
---|---|
Тема | Trigger using function written in PL/PGSQL returns "Unrecognized language specified" |
Дата | |
Msg-id | 5.0.2.1.0.20010209204123.028f5658@10.0.0.254 обсуждение исходный текст |
Ответы |
Re: Trigger using function written in PL/PGSQL returns
"Unrecognized language specified"
|
Список | pgsql-novice |
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@cyclonecomputers.com
В списке pgsql-novice по дате отправления: