We support the four standard set operations (UNION, UNION ALL, INTERSECT, EXCEPT), but PostgreSQL also supports INTERSECT ALL and EXCEPT ALL (which don't return distinct elements, much like UNION ALL). Our current design uses an enum to represent the operation type, so it's not easily extensible by providers. Options include:
- Having an Other enum value which allows relational to understand it's a set operation, but also allows providers to specify additional information on its SelectExpression that would allow the correct operation to be rendered to SQL.
- Have a SetOperationExpression deriving from SelectExpression, allowing providers to derive from that. However, I'm not clear on the extension/inheritance architecture with regards to providers (who should also be able to extend SelectExpression in order to override logic there?).
Actual need for INTERSECT ALL and EXCEPT ALL isn't likely to be high, so we can also punt this (although it's a pretty fundamental design discussion).
Unrelated note: MySQL only supports UNION and UNION ALL, no INTERSECT or EXCEPT.
We support the four standard set operations (UNION, UNION ALL, INTERSECT, EXCEPT), but PostgreSQL also supports INTERSECT ALL and EXCEPT ALL (which don't return distinct elements, much like UNION ALL). Our current design uses an enum to represent the operation type, so it's not easily extensible by providers. Options include:
Actual need for INTERSECT ALL and EXCEPT ALL isn't likely to be high, so we can also punt this (although it's a pretty fundamental design discussion).
Unrelated note: MySQL only supports UNION and UNION ALL, no INTERSECT or EXCEPT.