From: Philip J. Boonzaaier <phil@cobol-africa.com>
To: pgsql-sql@postgresql.org
Subject: Triggers
Date: Thu, 26 Feb 2004 12:18:57 +0200
Message-ID: <NEBBKNKPCLAAGALDLMCBEEOPCHAA.phil@cobol-africa.com> (raw)
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 ????
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: phil@cobol-africa.com
Subject: Re: Triggers
In-Reply-To: <NEBBKNKPCLAAGALDLMCBEEOPCHAA.phil@cobol-africa.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox