Re: Triggers do not fire - Mailing list pgsql-sql

From Tom Lane
Subject Re: Triggers do not fire
Date
Msg-id 22705.1003268168@sss.pgh.pa.us
Whole thread Raw
In response to Triggers do not fire  (Reiner Dassing <dassing@wettzell.ifag.de>)
List pgsql-sql
Reiner Dassing <dassing@wettzell.ifag.de> writes:
> I have written a very small test procedure to show a possible error
> on PostgreSQL V7.1.1.

The error is yours: you set up the trigger function to return NULL,
which means it's telling the system not to allow the INSERT or UPDATE.

> INSERT INTO test VALUES(1,'2000-10-11 12:00:00',-20.2);
> NOTICE:  Fired INSERT
> INSERT 0 0

Note the summary line saying that zero rows were inserted.

> UPDATE test SET value = 1000.0 WHERE epoch = '2000-10-11 12:10:00'  AND
> sensor_id = 1;
> UPDATE 0

Here, zero rows were updated, so of course there was nothing to fire
the trigger on.
        regards, tom lane


pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: index problem
Next
From: "Aasmund Midttun Godal"
Date:
Subject: Re: Triggers do not fire