Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The problem is: NULL is a valid datatype in many situations. There are non-boolean fields that can just be empty; My goto example:

    -- Table definition for employee
    name, surname, date_entry , date_exit
Everyone has names, and if hes an employee, he probably has an entry date...but until he leaves, what's the exit date?

Other than soothsaying, my choices here are: NULL, some magic value, or an additional field telling me whether the application should evaluate the field.

The latter just makes the code more complicated.

Magic values may not be portable, and lead to a whole range of other problems if applications forget to check for them; I count myself lucky if the result is something as harmless as an auto-email congratulating an employee to his 7000s-something birthday.

That leaves me with NULL. Yes, it causes problems. Many problems. But at least it causes predictable problems like apps crashing when some python code tries to shove a NULL into datetime.datetime.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: