Move DISTINCT handling to the Aggregate base class.
Django ships with a few Aggregate subclasses that expose a distinct kwarg in order to inject a DISTINCT clause on compilation.
Since DISTINCT is repeatedly used by subclasses and likely to be useful for custom Aggregate subclasses (PostgreSQL supports DISTINCT on all aggregate functions, SQLite on all aggregates with a single argument, ...) I suggest we handle it in the Aggregate base class.
We should be able to rely on DatebaseOperations.check_expression_support to prevent distinct=True from being passed to aggregates not supporting it on a backend basis.
Change History
(9)
| Has patch: |
set
|
| Patch needs improvement: |
set
|
| Triage Stage: |
Unreviewed → Accepted
|
| Patch needs improvement: |
unset
|
| Patch needs improvement: |
set
|
| Patch needs improvement: |
unset
|
| Resolution: |
→ fixed
|
| Status: |
assigned → closed
|
PR