Re: Disable and enable of table and column constraints - Mailing list pgsql-hackers

From Kevin Grittner
Subject Re: Disable and enable of table and column constraints
Date
Msg-id 4AA77411020000250002ABB8@gw.wicourts.gov
Whole thread Raw
In response to Re: Disable and enable of table and column constraints  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
Alvaro Herrera <alvherre@commandprompt.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


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: More robust pg_hba.conf parsing/error logging
Next
From: Tom Lane
Date:
Subject: Re: COALESCE and NULLIF semantics