News for hackers. Stuff that matters.
Re:We Can Do Better Than SQL by beefield on Thursday May 09, 2019 @04:00PM (#19871776)
Not sure if there is something wrong in my brain but I have not been able to understand the hate against NULL. To me the three value logic feels very natural and just clicks. Lately I have been dipping my toes into Alteryx, which treats empty values in a way that definitely does not correspond to 'normal' NULL logic in databases and it feels very much like a constraint on building my workflows.
Re:We Can Do Better Than SQL by vpetrovykh on Thursday May 09, 2019 @04:46PM (#19872262)
If a NULL were just a value in 3-valued logic, it could have been OK. However, that's not how it works out. Consider the following (that should be equivalent if NULL is just like Maybe in True-Maybe-False logic):

  SELECT null AND true;

  SELECT bool_and(column1) FROM (VALUES (null::bool),(true)) AS foo;
In PostgreSQL the first query produces NULL, while the second produces TRUE. Yet, it's also possible to get NULL as a result of aggregating values with bool_and:

  SELECT bool_and(column1) FROM (VALUES (null::bool),(null::bool)) AS foo;
And that's not how a 3-valued logic works.
Re:We Can Do Better Than SQL by MarkusWinand on Friday May 10, 2019 @01:52AM (#19875395)
You are mixing two concepts here: 3VL and how most aggregates work in SQL: the drop NULL values before doing their work. That's why the first BOOL_AND example only sees one value, thus returning true.