Comment by ancarda
6 years ago
I never understand how these sorts of bugs happen - is the database something like:
plate VARCHAR(8) NOT NULL DEFAULT "NULL"
Or rather the type is actually Option<String>:
plate VARCHAR(8) NULL DEFAULT NULL
In which case, how is it the software can't tell the difference between Some("NULL") and None()?
The only thing I can think of is the software (or it's database driver) handles everything in strings; so None() and Some("NULL") both get converted to "NULL"?
Based on the description in the article, it's a separate system that is actually entering "NULL" in the license plate string field, probably for things like red light camera violations. Chances are it's a human doing this according to a procedure or the system is setup to require entry of some text in the field, so they have to enter something and opted for "NULL" if the actual plate is unreadable / unreliable / not present. This is unfortunately how a lot of things in the real world work, especially on legacy systems.
There's a good chance it's some text file in CSV or fixed-width format being shipped around.