|
|
|
|
|
by Skeime
20 days ago
|
|
It is the language's fault, because SQL offers no good way to get nested results. If you want to avoid the duplication, you can do multiple queries, but then you essentially have to do the join on the receiving end, which kind of defeats the purpose of having joins in SQL. Alternatively, you might use functions to aggregate in the query, but they're not standard, as far I know, which means that interfaces in programming languages often do not support them. The best bet might be aggregating into JSON, but this removes quite a bit of the type information that values in SQL usually carry. (Also, the aggregation functions are generally less pleasant to write than standard joins.) |
|
JSON agg is what Gel does internally, and engines like Reylo[0] can do type inference so you get some type safety in your language of choice. Still quite lossy, as you say.
[0] https://github.com/colinhacks/reylo