Opened 9 years ago
Closed 9 years ago
#25914 closed Bug (needsinfo)
order_by not consistently returning data in specified order
Reported by: | shmkrause | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.8 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When ordering model records by timestamp and slicing, where the start parameter has not been specified, the query does not pull data in the order specified.
To be more specific, the code I have is:
data = MyModel.objects.order_by('-timestamp')[:100]
Output ordering is not consistent; expected data should all be from today (December 10, 2015), but data returned is stamped either December 1, 2015 or December 10, 2015. There is no discernible pattern as to when data from the first and the tenth is given.
Note that adding the start parameter for the slice stops this behaviour from occurring.
Change History (2)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
Could you provide a test case for Django's test suite or at least a sample project that reproduces the behavior? We don't know what the model looks like or what database you're using. Thanks!