Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#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: UI/UX:


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 should mention this and the examples without order_by should be removed.

Change History (2)

comment:1 Changed 7 years ago by ubernostrum

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

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.

comment:2 Changed 7 years ago by mtredinnick

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.

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