← Back to context

Comment by dragonwriter

7 years ago

It's only a slight misstatement; scalar queries are a subset of table queries in SQL, rather than different thing, but scalar queries are allowed in places where other table queries are not.

The difference in EdgeDB isn't really everything returns a set, but seems instead to be that everything consumes sets and not just scalars.

You are exactly right about everything consuming sets in EdgeDB. Even when a function is defined on scalars, it's really defined on singleton sets. Literals are also singleton sets, so "1" and "{1}" are equivalent and so are "foo(1)" and "foo({1})". Usually we omit the set braces for singleton values to reduce visual noise.