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

I'll give you that, but it's a very contrived example. I'm trying to think more of real world problems.

Many people have mentioned the idea of keeping track of if someone doesn't have a middle name versus you don't know their middle name. That makes more sense as an example (although I'm not sure how critical that is).



Treating the empty string as NULL, as ORACLE does, is the sane option on real world problems. Having "" different from NULL creates a lot of problems and the advantages are minimal. As you say, in the rare cases that you must tell WHY it is null, it is better to have a separated Boolean field, than to store "" vs NULL and give a meaning to each one.

One of the first problems that you'll encounter if you use a DB with "" != NULL is at data display, because the natural display for NULL and "" are "an empty cell". Then you cannot tell if it is NULL or ""... then you must display something else for NULL... then...

You have no such problem if "" is NULL, an empty cell always means NULL


They're different, and they mean different things. NULL means "I don't know this", whereas "" means "I know this is empty".

Data display with NULL != "" is easy, do what SSMS does and italicise/otherwise highlight the NULL.

What problems does "" being different to NULL cause?


> Having "" different from NULL creates a lot of problems and the advantages are minimal.

My experience is the exact opposite.


I can think of one way to display the data... JSON.




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

Search: