Function and trigger - Mailing list pgsql-novice

From Ola Ekedahl
Subject Function and trigger
Date
Msg-id 4938FC4C.70904@fra.se
Whole thread Raw
Responses Re: Function and trigger  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Re: Function and trigger  (Tovo Rabemanantsoa <tovo@bordeaux.inra.fr>)
List pgsql-novice
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 by date:

Previous
From: "Lee, Mija"
Date:
Subject: pg_dump usage of /tmp
Next
From: "A. Kretschmer"
Date:
Subject: Re: Function and trigger