Today's submitter identifies themselves as pleaseKillMe, which hey, c'mon buddy. Things aren't that bad. Besides, you shouldn't let the bad code you inherit drive you to depression- it should drive you to revenge.
Today's simple representative line is one that we share because it's not just representative of our submitter's code base, but one that shows up surprisingly often.
SELECT * FROM users WHERE last_name='NULL'
Now, I don't think this particular code impacted Mr. Null, but it certainly could have. That's just a special case of names being hard.
In this application, last_name
is a nullable field. They could just store a NULL
, but due to data sanitization issues, they stored 'NULL'
instead- a string. NULL
is not 'NULL'
, and thus- we've got a lot of 'NULL'
s that may have been intended to be NULL
, but also could be somebody's last name. At this point, we have no way to know.