Subject Re: [Firebird-Architect] Database triggers
Author Ann W. Harrison
Adriano dos Santos Fernandes wrote:
> BTW, do people here prefer ON instead of BEFORE/AFTER?

Syntax doesn't matter, but semantics do. ON is not semantically
equivalent to BEFORE / AFTER. A possible use of a database
trigger is logging attempts to connect. For that having
both a BEFORE and and AFTER CONNECT could be useful to record
unsuccessful as well as successful connection attempts. The
question, however, is whether that's the best way to handle that
problem. Should that information be generally available? If
not, how do you keep some random person from creating a trigger
to harvest user names?

Or another instance. You might want to use triggers to supplement
deferred constraints. Those triggers must fire before the commit
completes - you don't want to discover an inconsistency after the
commit happens and the changes are visible. Other actions - logging
successful transactions for example - need to happen after the
commit happens.