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

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 (view raw or flat)
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

pgsql-sql by date

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

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