Search Postgresql Archives

Re: BEFORE UPDATE trigger also fires at insert?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Clemens Eisserer <linuxhippy@xxxxxxxxx> writes:
> I've defined a small trigger to increment a field each time the row is updated:

>> CREATE TRIGGER inc_trigger BEFORE UPDATE ON Table FOR EACH ROW EXECUTE PROCEDURE inc_function();

> Works quite well, however the trigger is also fired if the table
> itself is modified.
> When deleting or inserting a single row, the trigger is executed for
> all rows contained in the table.

> Is this intetional, and if so, how can I get the behaviour to only
> execute the trigger when an update on the relation is performed?

That trigger definition will most certainly only fire on updates.

Are you sure you don't have additional trigger definitions calling the
same function?  Or maybe there are some rules on the table that result
in update actions?

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux