Function and trigger

Поиск
Список
Период
Сортировка
Искать
От
Ola Ekedahl
Тема
Function and trigger
Дата
Msg-id
4938FC4C.70904@fra.se
Список
Дерево обсуждения
Function and trigger Ola Ekedahl <ola.ekedahl@fra.se>
Re: Function and trigger "A. Kretschmer" <andreas.kretschmer@schollglas.com>
Re: Function and trigger Ola Ekedahl <ola.ekedahl@fra.se>
Re: Function and trigger Tovo Rabemanantsoa <tovo@bordeaux.inra.fr>
Hi,

I have e problem with a function (plpgsql) and a trigger in my database.
Postgres and triggers/functions are new to me...

Anyway, the database is filled with larg amounts of measurements, we are 
talking about a couple of hundres of thousands of posts per day.
I want to create a function that checks for a specific type of 
measurement and then copies it's value to another table. The functions 
looked almost like this:

BEGIN

IF NEW.TYPE=100 THEN
 INSERT INTO newtable (type,quantity) VALUES (NEW.TYPE, NEW.QUANTITY);
END IF;

END;

I tried to run a similar function (not created for use with a trigger) 
on a dummy table, and it inserted the values I told it to without any 
errors. I know that the function is correct and shouldnt give me any errors.

But when I tried to run the followin function with a trigger on the 
"real" table with the real data it just didnt work! The "real" table is 
not filled with any more data and the "newtable" isnt filled with any 
data either!

I must have missed something very important!?

Best regards and thanks in advance!
Ola
В списке pgsql-novice по дате отправления
От: Lee, Mija
Дата:
Сообщение: pg_dump usage of /tmp
От: A. Kretschmer
Дата:
Сообщение: Re: Function and trigger
FAQ