Re: "All triggers are evil",..., really?
Date: Thu, 21 Aug 2008 08:34:44 +1000
Toon Koppelaars wrote,on my timestamp of 20/08/2008 11:32 PM:
> I need to get this of my chest....
> I disagree that "all triggers are evil". Sure, a lot are evil, but not all.
Hmmmm, this is one of the very, very few areas in which I disagree with Tom. The problem I have with that article is that in this day and age of "follow that recipe", it can be mis-interpreted and result in a generalized "all triggers are evil". Which is not the case. They are just one of the many tools available.
Sure: implementing referential integrity solely on the base of triggers is likely a very bad move. Just like abusing anything else, abusing the use of triggers is not a good idea. But used where needed and with caution - never subverting the integrity mechanisms of the transactions, for example - they are really useful.
I'm a fan of login triggers, for example: they are a great way of slipping-in a ALTER SESSION SET CURRENT_SCHEMA=<whatever> and avoiding all the pains associated with private synonyms. Try and run multiple applications with common table names in a single instance and you'll know what I'm talking about. And at the current prices of Oracle, who isn't trying to run more than one app per instance?
Are "all" triggers evil? No way. Are some evil? Yes, for sure. So is some SQL, some PL/SQL, some views, you get the picture.
> Ideally we should finally get (from our DBMS vendor) support for the
> CREATE ASSERTION command which has been in the SQL standard for a long,
> long time. Only when we have this support, will I too agree that "all
> triggers are evil".
Not even then. But entirely agreed: long overdue, that one. Should have been there right from the start of declarative referential integrity.
-- Cheers Nuno Souto in sunny Sydney, Australia dbvision_at_iinet.net.au -- http://www.freelists.org/webpage/oracle-lReceived on Wed Aug 20 2008 - 17:34:44 CDT