Alexey Pechnikov wrote:
> Hello!
> 
> On Sunday 20 September 2009 00:14:56 Darren Duncan wrote:
>> 3b.  I would like to have the option for SQLite to always operate using 
>> 2-valued-logic rather than 3-valued-logic, meaning that NULL is simply 
>> treated 
>> as another value of its own singleton type that is disjoint from all other 
>> types 
>> same as Integer, Numeric, Text, Blob are disjoint.  And so, one could then 
>> just 
>> use ordinary equality or not-equality tests to check for NULL, and NULL 
>> would 
>> equal NULL but not equal anything else, and boolean tests would always 
>> return 
>> true or false, not null.  Once again, this would mean that behavior is more 
>> like 
>> what users actually expect and bugs can be avoided, and the query optimizer 
>> can 
>> be more efficient again, allowing more reorganization knowing at answers 
>> wouldn't change due to this.
> 
> NULL is the old RDBMS problem. And SQLite Tcl interface has no equal 
> availability 
> for NULL values because we can't operate with non-defined variables. So we 
> can 
> translate NULL values into empty Tcl strings but not vice versa.

Well we could also ditch NULL entirely in the database as the relational model 
doesn't actually require it and it is simply a convenient way to say we know we 
don't have normal data somewhere.  Though NULL is also deficient in that way 
because it doesn't say *why* we don't have normal data (eg, not applicable 
versus applicable but unknown).  I would argue for the elimination of NULL 
entirely and just let people design their databases to explicitly say "this 
point is missing for this reason", but what I proposed above was meant to be a 
softer intermediate approach to let NULL-depending people down easier.

As for Tcl, well one solution there is to create a new singleton TCL type and 
use its one value to correspond to NULL, and so then empty string will continue 
to just mean empty string, as it should.  Not being able to distinguish 
known-to-be-an-empty-string from unknown-or-N/A value is a *bad* thing.

-- Darren Duncan
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to