16 ms·
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 do
by pjungwir 5y ago
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.
- einpoklum 5y ago> 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".
- Teafling 5y agoOP explains why this is not the same in all the other sentences of their comment
- fnord77 5y agoyou can use COALESCE to remove nulls
- bmn__ 5y agoExplanation 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.
- zX41ZdbW 5y agoThis 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/nullable/ https://clickhouse.tech/docs/en/sql-reference/data-types/nul...