(2003 to 2005)

Nullable stuff

Mon May 31 01:16:00 UTC+1000 2004


I've come around to the thinking that any data can be null *at some point*.

So, even if a field is 'not nullable' in the data persistance layer, it is possible that at some point the value is not known.

The classic example is the autogenerated primary key.

This is not a nullable value, but prior to persistence in the database you can't say what value it has.

So, you either have to use a sentinel value to represent 'unknown', 'not allocated', etc., or represent null in some other way.

If any data can be unknown at any point then it is nullable, and most data can be unknown at some point.

Insisting that data is not null is just a function of validation, not a function of representation.


Copyright © 2003-2005 John Elliot