specql
specql copied to clipboard
Feature request: new option to add distinct / distinct on
Adding DISTINCT / DISTINCT on would be pretty useful, e.g.
SELECT DISTINCT ON (location) location, time, report
FROM weather_reports
ORDER BY location, time DESC;
I propose a new option :specql.core/distinct
- If provided value is nil or key is not present, it will use SELECT ALL (current behaviour)
- If value is empty seq, it will use DISTINCT
- If value is a seq of columns, it will use DISTINCT ON
Willing to provide a PR
Good feature, but I'm not sure about the empty seq parameter.
Perhaps it should be false (default) / true (distinct) / columns (distinct on).
Feels like empty seq could mask some bugs, but if there is a rationale for it.
I like that. I had no specific reason to go for the empty seq. Just trying to figure out a value that signifies plain distinct across all columns.
PR welcome