From: | "Darrell Skogman" <darrellskogman(at)email(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Performing INSERT from a Trigger fired function |
Date: | 2002-10-04 11:54:19 |
Message-ID: | 20021004115419.18344.qmail@email.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I want to be able to capture changes to a db with the use of triggers. I have created a simple db to test the methods to do this. When I change the age in this example, I get the error - "cashe lookup failed". I drop the trigger and the function before I make a change to the function and create the function and then the trigger to test changes. I always get this error. The scripts I use are attached. Thanks in advance the any ad all input... I love this stuff!
CREATE TABLE "consumer" (
"name" varchar(35),
"age" int4
);
----------
CREATE TABLE "changes" (
"name" varchar(50),
"oldage" int4
);
----------------------------
CREATE FUNCTION "save_change"() RETURNS "opaque" AS
'BEGIN
INSERT INTO changes( name, oldage )
VALUES( new.name, old.age );
RETURN new;
END;
' LANGUAGE 'plpgsql';
-------------------------------------------------
CREATE TRIGGER "xs" AFTER UPDATE ON "consumer" FOR EACH ROW EXECUTE PROCEDURE save_change()
--------------------------------------------------
DROP Trigger "xs" on "consumer" ;
------------------------------------------------
DROP FUNCTION "save_change"();
--
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup
"Free price comparison tool gives you the best prices and cash back!"
http://www.bestbuyfinder.com/download.htm
From | Date | Subject | |
---|---|---|---|
Next Message | Neil Conway | 2002-10-04 12:10:37 | Re: Query optimization |
Previous Message | Richard Huxton | 2002-10-04 11:13:05 | Re: Structured Types, Oids and Reference Types |