News for hackers. Stuff that matters.
Re:Against SQL by pjungwir on Saturday July 10, 2021 @03:21AM (#27791738)
It would be really cool if databases had an Option<T> type. Then you could remove all the NULLs. Although you can mark a column as NOT NULL, that restriction doesn't "travel": it isn't present for function inputs/outputs, subquery results, etc. Adding it to the type system gives you a lot more mileage. And then joins could be option-aware: an inner join would have outputs matching the input types, but an outer join would have Option outputs (for at least one side).

I'm curious how much work has been done on optimizers for Tutorial D or other D variants. It looks way nicer to use, but I wonder if it is easier to stumble into pathological cases.

Re:Against SQL by zX41ZdbW on Saturday July 10, 2021 @07:57PM (#27797343)
This is how it is done in ClickHouse. It has Nullable(T) type. The functions of non-Nullable types will return non-Nullable types (except some specific functions).

https://clickhouse.tech/docs/en/sql-reference/data-types/nul...

Re:Against SQL by fnord77 on Saturday July 10, 2021 @04:27AM (#27791996)
you can use COALESCE to remove nulls
Re:Against SQL by bmn__ on Sunday July 11, 2021 @05:32AM (#27799539)
Explanation for your downvotes: you misunderstood GP's post, he refers to removing the concept of null as it is currently specified from the language, not removing null values from data.
Re:Against SQL by einpoklum on Saturday July 10, 2021 @03:56AM (#27791897)
> It would be really cool if databases had an Option<T> type. Then you could remove all the NULLs.

A nullable T column _is_ an Option<T> column, with NULL representing "Empty" or "No Value".

Re:Against SQL by Teafling on Saturday July 10, 2021 @04:16AM (#27791950)
OP explains why this is not the same in all the other sentences of their comment