Triggers

From: "Philip J(dot) Boonzaaier" <phil(at)cobol-africa(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Triggers
Date: 2004-02-26 10:18:57
Message-ID: NEBBKNKPCLAAGALDLMCBEEOPCHAA.phil@cobol-africa.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

The technical reference gives an example of a trigger on a table - employee
Just to test this, I have created the following table,
CREATE TABLE employee
(name VARCHAR(30),
age int4,
state VARCHAR(2),
manager VARCHAR(3),
adult VARCHAR(3));

The I created a simple Function, as follows :

CREATE FUNCTION trig_insert_update_check_emp() RETURNS opaque AS '
BEGIN
IF new.age > 20 THEN
new.adult = ''yes'';
ELSE
new.adult = ''no'';
END IF;
END;
' LANGUAGE 'plpgsql';

Finally, I defined the Trigger as :

CREATE TRIGGER employee_insert_update
BEFORE INSERT OR UPDATE ON employee
FOR EACH ROW EXECUTE PROCEDURE trig_insert_update_check_emp();

Now, when I execute the following :

INSERT INTO employee (name,age,state,manager)
VALUES ('sean',29,'tx','yes');

I get :

ERROR fmgr_info function 6264440 cache lookup failed

What am I doing wrong ????

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Christopher Browne 2004-02-26 13:08:56 Re: Field list from table
Previous Message Achilleus Mantzios 2004-02-26 09:55:21 Re: updating remote database