Opened 16 months ago

Closed 8 days ago

#28658 closed Cleanup/optimization (fixed)

Move DISTINCT handling to the Aggregate base class.

Reported by: Simon Charette Owned by: Simon Charette
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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 (6)

comment:1 Changed 16 months ago by Simon Charette

Has patch: set
Patch needs improvement: set

comment:2 Changed 16 months ago by Tim Graham

Triage Stage: UnreviewedAccepted

comment:3 Changed 8 weeks ago by Simon Charette

Patch needs improvement: unset

comment:4 Changed 7 weeks ago by Tim Graham

Patch needs improvement: set

comment:5 Changed 5 weeks ago by Simon Charette

Patch needs improvement: unset

comment:6 Changed 8 days ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In bc05547:

Fixed #28658 -- Added DISTINCT handling to the Aggregate class.

Note: See TracTickets for help on using tickets.
Back to Top