3 ms·
If you are using a nullable bool, you do not need a fourth state. True, False, Unset. Very useful in a lot of cases. It's actually not ugly but very elegant.
by hallway_monitor 6y ago
If you are using a nullable bool, you do not need a fourth state. True, False, Unset. Very useful in a lot of cases. It's actually not ugly but very elegant.
- m_mueller 6y agoI don't think it's elegant at all. Especially in SQL dialects where you need to check null state separately from false. So much bug potential...
- Spivak 6y agoWith an enum you’d have to check the unset state separate as well.
- crocarneiro 6y agoHe meant that in some SQL Dialects you cannot check FIELD = NULL, you have to use FIELD IS (NOT) NULL (like Oracle). Therefore you cannot use FIELD inside an IN clause either.
- andix 5y agoBut with an (NOT NULL) enum/integer/string or however you are representing it, every state is a regular case. Not a special case. Null nearly always needs some special treatment.