Re: Declaring Unenforced Constraints

From: Tony Andrews <andrewst_at_onetel.com>
Date: 17 Nov 2004 04:12:10 -0800
Message-ID: <1100693530.569471.231180_at_z14g2000cwz.googlegroups.com>


Kenneth Downs wrote:
> As a late response, may I ask if you perhaps meant delayed
enforcement? As
> in loading lots of data and then running some type of batch
enforcement
> later on? Or do you mean a constraint that is not enforced at all
ever?
>
> In the first case, it seems that we are not so much un-enforcing as
we are
> redefining a transaction. There are certain tables I have for a
batch
> operation, which have no declared constraints on them, though they do
have
> many unique and referential constraints that must be correct or I
have
> garbage going in. The lack of declared constraints allows the data
to be
> loaded in any order, such as children before parents. Just before it
> starts processing, it validates the entire set and reports all
errors, if
> there are any. In this sense the transaction is considered all
activities
> up to the request for processing.
>
> Of course we'll need to hear from Tony on how this creates Dirty
Reads in
> Oracle ;)

Impossible - Oracle is incapable of performing a dirty read (hurrah!)

Deferred constraints allow insert of children before parents: the constraint checking is only done at the end of the transaction.

Of course, for bulk data loading it may well be useful to disable the constraints, load the data, and then re-enable them (after fixing any problems). But the database must be off-line to normal users while this happens, otherwise they may see bad data (a dirty read of sorts, I suppose). However, your position appears to be not to have the constraints at all; I can't go along with that, as you no doubt could have guessed. Received on Wed Nov 17 2004 - 13:12:10 CET

Original text of this message