WL#929: CHECK constraints

Affects: Server-8.0   —   Status: Complete

The aim of the WL is to implement the CHECK constraint. This
WL supports the clause:

  [CONSTRAINT [constraint_name]] CHECK (condition) [[NOT] ENFORCED]
     
in CREATE TABLE and ALTER TABLE statements.     
     
A check constraint is satisfied if and only if the specified
condition evaluates to TRUE or UNKNOWN(for NULL column value)
for row of the table. The constraint is violated otherwise.

For example:     
     
  CREATE TABLE t (s1 INT, CHECK (s1 > 0))     
       
  INSERT INTO t VALUES (-1)     
  /* this should fail, the condition is FALSE */     
     
  INSERT INTO t VALUES (NULL)     
  /* this should succeed, the condition is UNKNOWN */    

This is an ANSI/ISO requirement, supported by the Oracle, PostgreSQL,
DB2 and SQL Server.