Re: NULLs: theoretical problems?

From: Jan Hidders <hidders_at_gmail.com>
Date: Sun, 19 Aug 2007 20:38:18 -0000
Message-ID: <1187555898.287393.128980_at_a39g2000hsc.googlegroups.com>


On 19 aug, 20:08, Keith H Duggar <dug..._at_alum.mit.edu> wrote:
> On Aug 16, 7:05?| pm, Jan Hidders <hidd..._at_gmail.com> wrote:
>
>
>
> > Btw. your interpretation of null values is basically the "missing
> > value" interpretation, with which theoretically speaking, there is of
> > course no problem whatsoever. But your insistence that NULL somehow at
> > the same time a marker that indicates that a value is missing and is
> > also a value itself (because an element of the domain) is a little bit
> > suspect. There are better and more consistent ways of describing
> > missing values.
>
> Will you please elaborate on those methods you
> consider better and more consistent?

My personal favorite is to allow tuples to be partial functions. Normally all tuples in a relation are total functions over the set of attribute names in the header. If you want to allow missing values you simply allow that function to be undefined for some of those attribute names. So a missing value is not modeled by a pseudo-value but by there simply being no value.

This creates of course the problem of undefined results. Propositions such as t.a = s.b might not have a well-defined truth value since t.a or s.b might not exist. But you can solve this with something that looks a little like an existence quantifier of the form "DEF <attr> : <formula>" where <formula> is a logical formula containing <attr>. The meaning of "DEFI t.a : f(t.a)" would be that t.a is defined and the formula f(t.a) holds. It would be required for nullable attributes, but not for not nullable attributes. So if t.a is nullable, and s.b not, then you would have to write "DEFI t.a : t.a = s.b". The need for this can be relatively straightforwardly checked by the DBMS.

Such a construct also makes clear how the rules of logic can or cannot be applied. For example, what now looks at first sight like a tautology, namely "t.a < 5 or t.a >= 5", would then look like either "(DEF t.a : t.a < 5) OR (DEF t.a : t.a >= 5)" or "DEF t.a : (t.a < 5 OR t.a >=5)". Both are equivalent with "DEF t.a : TRUE" but not with "TRUE". The logical rules for reasoning with this construct are not that difficult to see, and it avoids something like 3VL.

Received on Sun Aug 19 2007 - 22:38:18 CEST

Original text of this message