Are database triggers evil?

Posted by WW on Stack Overflow See other posts from Stack Overflow or by WW
Published on 2009-01-20T07:01:04Z Indexed on 2010/04/29 6:47 UTC
Read the original article Hit count: 349

Filed under:
|

Are database triggers a bad idea?

In my experience they are evil, because they can result in surprising side effects, and are difficult to debug (especially when one trigger fires another). Often developers do not even think of looking if there is a trigger.

On the other hand, it seems like if you have logic that must occur evertime a new FOO is created in the database then the most foolproof place to put it is an insert trigger on the FOO table.

The only time we're using triggers is for really simple things like setting the ModifiedDate.

© Stack Overflow or respective owner

Related posts about sql

Related posts about triggers