Consider adding type expression syntax to exclude or explicitly include subtypes
See original GitHub issueOn queries over type Foo
EdgeDB will include both Foo
objects and all objects of its descendant types. EdgeQL currently lacks a way to turn off automatic inclusion of inherited objects (a-la the SQL ONLY
keyword). There is a way to filter over the exact value of .__type__
, but that is neither elegant, nor very efficient if spelled in a most concise way (FILTER .__type__.name = 'default::BaseType'
).
ONLY
seems to be a good candidate for a modifier in a particular case of excluding all descendants.
By nature the ONLY
operator (and its tentative EXCEPT
counterpart) are type expression operators similar to the type union |
and intersection &
, so perhaps #1578 should be implemented first to avoid the tedium of repeating the inheritance op, e.g WITH MyType AS TYPE Foo ONLY
or WITH MyType AS TYPE Foo EXCEPT Subtype
. Also, perhaps EXCEPT
should be -
or ^
to be closer to other type operators.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:9 (9 by maintainers)
Correct, although I’m thinking a postfix form would be better.
This is an interesting idea — especially since it fits the EdgeDB niche where “everything is a set”.
From my perspective,
[IS ONLY]
could be an implementation derived from creating disjoint unions, and could even play an interesting role with the:-
operator since the disjoint union of A and B boils down to A − B.