Re: So what's null then if it's not nothing?

From: Hugo Kornelis <hugo_at_pe_NO_rFact.in_SPAM_fo>
Date: Mon, 05 Dec 2005 23:51:50 +0100
Message-ID: <7mg9p1ta4a4makhurqf54n60rli117d4sn_at_4ax.com>


On Sat, 3 Dec 2005 10:33:24 +0100, Jon Heggland wrote:

(snip)
>I also want NOT NULL to be default; it makes a difference. In D4 syntax
>(where NULL, or "nil" as Dataphor calls is, is disallowed by default):
>1. Age : Integer { nil }
>2. Age : Integer
>3. Age : Integer { nil,
> constraint PossiblyOldEnough IsNil(value) or value >= 16 }
>4. Age : Integer { constraint DefinitelyOldEnough value >= 16 }

Hi Jon,

Yes, with this change to the way to define nullability, you're describing a good alternative for the current SQL standards. I like this one too.

>
>> >Yes, I know. But that doesn't jive with what database textbooks teach:
>> >That constraints are assertions that hold true for all possible values
>> >of the database.
>>
>> Then these textbooks are wrong.
>
>Yes, given that they talk about SQL. If they talk about the relational
>model in a more abstract manner, what then?

Then they might be correct. If there's any formal and widely accepted definition of "constraint" in the context of (non-SQL) relational model, I'm not aware of it.

>And why are they so consistently "wrong"? The definition they give for
>constraints is simpler and more intuitive than the double negation that
>SQL uses,

You're answering your own questions. Many text books only touch the basics of whatever subject they're about. Explaining the subtle difference between "hold true for all possible values" and "not hold false for any possible value" is impossible without first exploring the subtleties of 3VL, and as you so correctly remark:

> and most textbooks don't talk about 3VL much. Maybe they
>should. I'd guess the textbooks consider 3VL and its use in constraint
>handling too complicated to explain properly. Or perhaps the authors
>aren't aware of the issues.

I couldn't have said it better myself!

(snip suggestion to call NULL / NOT NULL a property instead of a constraint - I agree with your reasons and have nothing to add to it).

Best, Hugo

-- 

(Remove _NO_ and _SPAM_ to get my e-mail address)
Received on Mon Dec 05 2005 - 23:51:50 CET

Original text of this message