#9916 closed (wontfix)
QuerySets should order_by pk as default
Reported by: | anonymous | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.0 |
Severity: | 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
At least with Postgresql using LIMIT and OFFSET at the same clause will give unpredictable results without an ORDER BY clause. QuerySets should use some kind of ordering as default, so that slicing api would work. At least the documentation at http://docs.djangoproject.com/en/dev/topics/db/queries/#id4 should mention this and the examples without order_by should be removed.
Change History (2)
comment:1 by , 16 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 by , 16 years ago
The actual problem being reported here will be fixed as part of #9006 and some other ticket I can't find right now. We need some potentially controlled ordering with limit/offset on some database backends. As ubernostrum mentions, though, always ordering is not an option.
Forcing ordering when none is specified would be a bad, bad thing. If you want ordering, use
order_by()
or set the ordering on the model so it'll be applied automatically for you.