I'm not sure if this applies, but in my experience it is normal for a unique value constraint to be satisfied on columns with null values, as is a foreign key constraint, which is only evaluated on not-null values. Following that precedent, I would say that the CHECK constraint should pass if its expression results to null.

If you're trying to enforce a certain kind of behaviour in a particular check constraint, you probably want to add some IS NULL expressions to explicitly declare the behaviour you want, to specify times when a null input would result in a check failure.

-- Darren Duncan

At 6:30 PM -0500 11/2/05, [EMAIL PROTECTED] wrote:
In a CHECK constraint, if the expression is NULL (neither true
nor false) does the constraint fail?

Example:

  CREATE TABLE ex1(
    x INTEGER,
    y REAL,
    CHECK( x<y )
  );

Then you do:

  INSERT INTO ex1 VALUES(5, NULL);

Does the check constraint fail or not?  Or do different
database engines do different things?

I need to know so that I can make check constraint in SQLite
work like they do in other database engines...

Reply via email to