Opened 10 years ago

Closed 10 years ago

#24268 closed Cleanup/optimization (fixed)

Remove Query.having

Reported by: Anssi Kääriäinen Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Instead of Query.having and Query.where we could instead use Query.where only, and then split that to where and having parts in the compiler.

The main reason for doing the split in compiler is that we gain a bit simpler Query class without any significant complications to the where class.

There are other cases, too, where such a split would be needed. For example, window aggregates can't be filtered on the same query level. So, qs.filter(row_num__lte=10) would need to be splitted into an outer query's where clause.

Change History (3)

comment:1 by Tim Graham, 10 years ago

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

comment:2 by Tim Graham, 10 years ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:3 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: newclosed

In afe0bb7b13bb8dc4370f32225238012c873b0ee3:

Fixed #24268 -- removed Query.having

Instead of splitting filter clauses to where and having parts before
adding them to query.where or query.having, add all filter clauses to
query.where, and when compiling the query split the where to having and
where parts.

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