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

From: Jon Heggland <heggland_at_idi.ntnu.no>
Date: Sun, 4 Dec 2005 17:05:01 +0100
Message-ID: <MPG.1dfd321c5d95cf89989727_at_news.ntnu.no>


In article <1133618666.699908.63940_at_g44g2000cwa.googlegroups.com>, boston103_at_hotmail.com says...
> Jon Heggland wrote:
> > And you don't agree with Clement-
> > Davies, that it would be a "curious mixture" "suggesting that a RDBMS
> > should use two-valued logic to detect tautologies, and three-valued
> > logic for everything else."?
>
> No, for the reason I stated above: there cannot be a general
> tautology mechanism , even in the 2vl, anyway, so why fret about it?

You're right it is a moot point; I fret about it because I take it as a sign of less than completely clear thinking.

> > Ah, but wouldn't it be convenient if you could? :) Or at least the
> > "standard interpretation" that something is equal and equivalent to
> > itself.
>
> Sure it would and it is with the exception of NULL. NULL due to its
> very vague nature cannot be equal to itself since obviously it does not
> denote a certain unique thing/idea/etc

... except if/when it is used as a truth value ..? But it seems we are coming to agreement about that. :)

> > Now *you* provide facts for the conclusion that Codd thought that
> > NULL=NULL sometimes evaluates to TRUE.
>
> The very fact of using thruth tables to define logical operator
> meanings says unambiguously : look, I have three logical constants
> {true, false, null} (or { true, false,w) in Codd's notation) and here
> how I define AND, OR, NOT connectives. If one says, that {true,
> false, null} are *not* logical constants, then one talks about
> anything whatsoever but logic.

But this is very implicit. I put greater weight on the "uniform treatment" bit.

> Let's assume Codd is confused, and he says NULL=NULL always evaluates
> to unknown/NULL. Then he contradicts himself by using the truth tables
> where NULL = NULL evaluates to TRUE by virtue of being a logical
> constant and not an unknown value as it might be in other contexts.

This contradiction is very implicit. And it is *possible* to define a 3VL system so that TRUE = TRUE and FALSE = FALSE but UNKNOWN != UNKNOWN (after all, we can define whatever we want); and the distinction between "we know it's unknown" and "we don't know what it is" is a bit hard to wrap your head around, IMO.

> I find it hard to believe that, being a mathematician, he was confused
> by elementary logic notions, althought it might have been the case.

You do of course have a point here.

> > So the boolean datatype, boolean columns and expressions are *still* not
> > part of the standard? I thought they were supposed to be part of SQL2
> > (or whatever it's called now).
>
> They are not and that's the reason why using NULL in two different
> contexts is not so much of a problem.

But surely it has been proposed and discussed? I seem to recall an old article by Date where he criticizes the proposal precisely on the grounds that it used NULL for UNKNOWN.

And it seems a curious omission indeed. TTM considers boolean the *only* datatype/domain that *must* be supported.

> > And if you use NULL for the unknown truth value, how do you designate a
> > missing one?
>
> But as I said multiple times, the real label is 'logic_context.NULL'
> or 'integer_context.NULL', not just NULL.

But if you had a boolean SQL type, how could you indicate which one you meant?

> > See above. Alternatively, consider it a matter of taste. Why make things
> > more messy than necessary by overloading symbols just for the hell of
> > it? What makes NULL a better symbol than UNKNOWN for the truth value?
>
> Nothing, and in this specific case of the 3vl (but not in the others)
> I actually agree with you, although I might have come through as
> meaning something entirely different ;)

You might indeed. :)

> > Then what do you base your assertion on?
>
> On knowing what the logical constant is, very much in the same
> fashion as you'd base your knowledge of '7 times 8 = 56' on being
> acquainted with the multiplication table.

I'd agree if Codd hadn't used the same symbol for reasons of uniform treatment.

> > Codd says: "[W]hat is the truth value of x = y if x or y or
> > both are null? An appropriate result in each of these cases is the
> > unknown truth value, rather than true or false." This is his rule,
> > whereas ...
>
> He talks about NULL in contexts *other* than that of logical constants.

That's a strong assumption on your part.

> > > I'll try again one last time. NULL in the
> > > context of some domain of values, integers, characters, whatever,
> >
> > (Truth values is also a domain.)
>
> Right, it's a trivial observation, but so what ? It's a different
> domain with different rules.

"Whatever" should IMO include the (very fundamental) boolean domain, so NULL in the context of boolean should also mean an unknown/missing value. Or why should that particular domain have different rules from all the rest?

> > > means an unknown/missing value (as defined by Codd and the SQL
> > > standard). NULL in the context of the 3vl is just another logical
> > > *constant* which has got nothing to do whatsoever with the meanning of
> > > NULL as a missing/unknown value.
> >
> > ... this is a different rule. Codd does *not* say this, and neither does
> > the SQL standard, by your own admission.
>
> In Codd's case, it's stated by virtue of his using the truth tables.

Very implicitly. And contradicted by the use of "w" instead of U. But I'm repeating myself, and I think we agree enough to let it go. :)

-- 
Jon
Received on Sun Dec 04 2005 - 17:05:01 CET

Original text of this message