| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Declaring Unenforced Constraints
Tony Andrews wrote:
> Kenneth Downs wrote:
>> So, to get back to the original thread. The solution was to add what
>> called "OK TO FAIL" to all constraints. What this meant was that the
>> would not abort on a constraint create failure, it would write it as
>> warning and keep going. This allowed us to get to 100% by degrees,
>> of in a big lurch. >> >> They eventually got fixed, mostly. At this shop the CEO would
>> show up with somebody and say, "this is my friend Johann Schmitt,
>> you have a spot for him?" What do you know! We did! Eventually one
>> these FOC's (friend of CEO) actually had some SQL skills, and we put
>> to running SELECTs to find offending data and working with the client
>> manually purge out the violations. Then we'd run an upgrade pass,
>> would notice the constraints were not there and would try to put them
>> in, and would finally succeed. >> >> In the end, the bigger clients all had their legacy constraints in
>> new improvements came in with the constraints in place from day 1.
Perhaps someday I'll convince you of how much easier that is to handle when the tables are ruthlessly normalized, so that much more checking can be done with key constraints.
>
> I am advocating adding constraints to enforce the rules in the
> database, so that bad code gets caught immediately and data fixes are
> not required. However, I have to recognise that this is a non-trivial
> undertaking, because:
>
> 1) probably every customer has some data that violates the constraint,
> even if it is historic data that will never be processed again. So the
> "ENABLE NOVALIDATE" option will need to be used in most cases (unless
> it is considered worth while fixing the data at every customer site at
> the same time as implementing the constraint).
I don't know about Oracle, but AFAICR in SQL Server you can also declare constraints w/o enforcing them on existing data. They are enforced, as we like to say these days, "on a go-forward basis."
>
> 2) extensive regression testing will be required, because it is highly
> likely that various parts of the application will be found to violate
> the constraint under some circumstances. Even then, we must be
> prepared that some customer will hit a constraint violation that out
> regression testing missed.
Yikes. Do you have extensive regression testing now? Unless you can make it completely automatic....
>
> It is early days yet, and I am wondering whether to suggest we go for a
> "big bang" approach where we implement tons of constraints at once,
> regression test like mad, and then wait for the screams; or a drip-feed
> where we implement a smaller number of constraints with each upgrade,
> regression test like mad, and hopefully get less issues, spread over a
> longer time frame.
In my experience drip-feed will more likely be accepted by the more people, giving you a greater overall good. Losing the fight for big-bang brings zero improvement, but going one-by-one gives you concrete and permanent improvements that will never cause trouble again. I wish you luck.
--
Kenneth Downs
java.lang.String.tcpip.usenet.posting.response.sigblock.setSig("After
finally finding the right object abd method to set the sig block, I forgot
what I wanted to say!");
Received on Thu Nov 18 2004 - 17:42:07 CST
![]() |
![]() |