RE: "All triggers are evil",..., really?
Date: Thu, 21 Aug 2008 07:56:42 -0500
So you aren't actually disagreeing with Tom. You are worried that the article might be misinterpreted? I can't find one flaw in that article. Tom readily admits that there are times when triggers are the only option but suggests there are often better alternatives. He then runs through a highly relevant example. I don't think the article was supposed to be a comprehensive treatment of trigger use.
For me at least, the article was excellent.
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Nuno Souto Sent: Wednesday, August 20, 2008 5:35 PM Cc: ORACLE-L
Subject: Re: "All triggers are evil",..., really?
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
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 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-l CONFIDENTIALITY NOTICE: This message is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient or the employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by email reply. -- http://www.freelists.org/webpage/oracle-lReceived on Thu Aug 21 2008 - 07:56:42 CDT