Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#26815 closed Bug (invalid)

Addition of Trunc may have altered the ordering of dates() queries

Reported by: Luke Benstead Owned by: nobody
Component: Database layer (models, ORM) Version: 1.10
Severity: Normal Keywords: dates, queryset
Cc: Josh Smeaton Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

We're looking into supporting Django 1.10 in Djangae, and while fixing up some breakages I noticed a change in the way that dates() queries are ordered. I'm not 100% sure this is a real bug as I'm looking at the code in a fairly abnormal situation, but it definitely seems like a bug...

This line was recently added as part of the datetime expression changes:

https://github.com/django/django/commit/2a4af0ea43512370764303d35bc5309f8abce666#diff-5b0dda5eb9a242c15879dc9cd2121379R743

It seems to me that now, instead of ordering by the full date, this change will make dates queries order by just the component that they are selecting (e.g. year, month, day etc.) - although I might be wrong about this!

Change History (4)

comment:1 by Tim Graham, 8 years ago

Could you provide example queries to demonstrate the bug?

comment:2 by Tim Graham, 8 years ago

Resolution: needsinfo
Status: newclosed

Does this assertion show the expected behavior?

comment:3 by Luke Benstead, 8 years ago

Yeah, that test proves I'm wrong. Sorry!

comment:4 by Tim Graham, 8 years ago

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