Subject Re: [firebird-support] Are before triggers absolutely reliable? What happens if they fail?
Author Martijn Tonies
Hello Mitch,

> I have a before insert trigger which includes NEW.DOC_CREATED_DATE =
> CURRENT_TIMESTAMP;
>
> 99% of the time this works, but 1% of the time there is a null value.
>
> I assume that there can be only 2 causes. Either 1. the trigger is
> failing or 2. the column is being overwritten somehow after the insert.

It has to be (2), that is, if you're not turning the trigger inactive
somewhere.

> In order to discount #1, would it be true to say that if a trigger
> and/or generator fails for some reason that there would be an error
> message and the insert would not occur?

If a trigger raises an error, the client will receive the error and the
record will not be inserted.

> Can transaction control be used to enforce this at the trigger level
> or do transactions only exist in the context of an external application?

Triggers work in the same transaction as the transaction that caused
the INSERT to happen.

What is the full source of the trigger?

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com