3 ms·
> EdgeQL has no NULL. So how is a missing value in a column represented? A column value is a scalar value, not a "set". As much as I accept that NULL values ar
by hans_castorp 8y ago
> EdgeQL has no NULL.
So how is a missing value in a column represented? A column value is a scalar value, not a "set". As much as I accept that NULL values are a pain to deal with, I don't see a way to represent the absence of information in another way. You can't store an "empty set" in a column.
A NULL _value_ in SQL is something completely different than a NULL reference or pointer in a programming language. Although both have the same name the underlying concept is completely different.
> Functions in SQL can return NULL to signal an error condition.
That's plain wrong. functions in SQL signal errors by throwing an exception
- 1st1 8y ago> So how is a missing value in a column represented? Explained in this thread: https://news.ycombinator.com/item?id=19641060 https://news.ycombinator.com/item?id=19641060 > > Functions in SQL can return NULL to signal an error condition. > That's plain wrong. functions in SQL signal errors by throwing an exception Well, just as an example: take a look at the 'to_number()' function. It will happily return NULL if the format string is an empty string. An empty format is an error condition (it's not documented to return NULL, btw, see [1]) at least in some contexts, so the returned NULL breaking the query can be very unintuitive. So yes, throwing an exception is what happens in 99% of situations, until you hit a weird case where a NULL is returned unexpectedly for you. And I'm not saying that returning NULL is bad for 'to_number()'; in SQL that's OK. It's just not how we approach things in EdgeQL. [1] https://www.postgresql.org/docs/11/functions-formatting.html https://www.postgresql.org/docs/11/functions-formatting.html