we do get input to database both from UI and custom made sql-string-replication. (i.e it feeds tables with statements).
Due this replication we have implemented triggers.
Everything is fine, but now we should find a smart way NOT to fire trigger when input comes from replication.
Anyone with good ideas ??
Disabling or enabling the trigger may impact UI (non-replication) table updates.
Add a table to hold the replication update user's logon name for the replication updates.
Change your trigger function to first check for the user name presence in the above table. If there is no user in the table, it's a standard table update taking place, so the trigger function continues normally. If there IS a record of this user's name in the above table, replication is taking place; do not perform the code in the function.
Finally, alter the replication script, so that it writes the current user name to the table above before writing replication records into the main table, and removes the current user name at the end of the script.
This way, while user Bob starts the replication script, if user Fred then used the UI while the replication update was taking place, Fred's updates would be handled normally, even while Bob's replication updates would cause the trigger function to 'short circuit' its normal operation.
The only time this would 'bite you' would be if Bob tried to use the UI at the same time he's running the replication script...
"Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
"I have my standards. They may be low, but I have them!" - Bette Middler
"It's a book about a Spanish guy named Manual. You should read it." - Dilbert