News for hackers. Stuff that matters.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers by 00098345 on Sunday September 04, 2016 @07:47PM (#12427283)
I have to disagree with Hoare sensei there. The number is nowhere near a billion. I personally know of one case that totaled to a billion.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers by koolkao on Sunday September 04, 2016 @07:55PM (#12427308)
Would love to learn more about this single billion dollar mistake
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers by 00098345 on Sunday September 04, 2016 @08:21PM (#12427394)
SQL summation without coalescing null addenda to zero. The sum result was a null. This had been going on for years. Oops!

The lesson/mitigation was to add a NOT NULL attribute on top of a DEFAULT 0.

Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers by int_19h on Monday September 05, 2016 @01:46AM (#12428373)
Hoare was talking about null references specifically. Or, to be even more precise, making references nullable by default, and allowing all operations on them in the type system, with U.B. or runtime errors if they actually happen.

NULL in SQL is a very different and largely unrelated concept. Though probably a mistake just as bad - not the concept itself even, but the name. Why did they ever think that "NULL" was a smart name to give to an unknown value? For developers, by the time SQL was a thing, "null" was already a fairly established way to describe null pointers/references. For non-developers, whom SQL presumably targeted, "null" just means zero, which is emphatically not the same thing as "unknown". They really should have called it "UNKNOWN" - then its semantics would make sense, and people wouldn't use it to denote a value that is missing (but known).

Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers by brobinson on Sunday September 04, 2016 @10:02PM (#12427678)
Sounds like this could have also been mitigated by either the SQL server warning about SUM() operating over a nullable column or a "where foo is not null" clause. Your solution is best, though.