Performing INSERT from a Trigger fired function

Поиск
Список
Период
Сортировка
От Darrell Skogman
Тема Performing INSERT from a Trigger fired function
Дата
Msg-id 20021004115419.18344.qmail@email.com
обсуждение исходный текст
Ответы Re: Performing INSERT from a Trigger fired function
Список 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
todo this. When I change the age in this example, I get the error - "cashe lookup failed". I drop the trigger and the
functionbefore I make a change to the function and create the function and then the trigger to test changes. I always
getthis 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


В списке pgsql-general по дате отправления:

Предыдущее
От: andreas@sparcy.net (Andreas Forsgren)
Дата:
Сообщение: Odd sum() problem in 7.2.2
Следующее
От: "luc neulens"
Дата:
Сообщение: transactions