News for hackers. Stuff that matters.
Re:Postgres 15 improves UNIQUE and NULL by nightski on Monday July 11, 2022 @09:04AM (#32055625)
I think a lot of the trouble stems from the fact that databases do not have sum types and there is no way to encode a "None" type without hacks. NULL is the only reasonable option in a lot of cases.
Re:Postgres 15 improves UNIQUE and NULL by wongarsu on Monday July 11, 2022 @09:33AM (#32055901)
Yeah, in hindsight the world would be a slightly better place if SQL didn't include NULL, but instead "UNKNOWN" and "NONE", with "NONE = NONE" being true, and "UNKNOWN = UNKNOWN" being unknown.
Re:Postgres 15 improves UNIQUE and NULL by stouset on Monday July 11, 2022 @12:51PM (#32058587)
Or have an Option (or Maybe) type. This is how modern programming languages solve the nil issue, I don't see a reason why a database couldn't take the same approach.
Re:Postgres 15 improves UNIQUE and NULL by kzrdude on Monday July 11, 2022 @01:08PM (#32058791)
When would NONE show up and when would UNKNOWN show up?
Re:Postgres 15 improves UNIQUE and NULL by wtetzner on Monday July 11, 2022 @03:48PM (#32060863)
NONE would mean “there is no value”, and UNKNOWN “there might be a value, but I don’t know what it is”.