Alvaro Herrera <alvherre(at)commandprompt(dot)com> wrote:
> Both DB2 and Oracle have an ENFORCE setting for constraints, and a
> MySQL blog hinted some time ago that it might be in SQL 201x.
If I remember correctly, Sybase never checks the existing data when
you add a constraint of any type (except for a unique constraint or
primary key).
That has occasionally been useful to me when a business rule has been
identified which we want to enforce in an existing database, but there
hasn't yet been enforcement of that rule. You can "plug the leak"
first, then list the legacy problems and get those on a list for
cleanup. If you insist that all preexisting bad data must be cleaned
up before you can prevent more bad data from going in, you might never
*get* clean because of a steady dribble of additional bad data while
you are attempting cleanup.
(Well, OK, you could always enforce the rule at some other layer and
hope to get enough traction to correct the problems, but it is nice to
have help from the DBMS in this regard, without having to code
triggers to get there.)
-Kevin