Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#3825 closed (duplicate)

crash on sorting on foreign key with default ordering desc

Reported by: David S. <davidschein@…> Owned by: adrian
Component: Database layer (models, ORM) Version: master
Severity: Keywords: ordering foreignkey
Cc: None Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:


This bug became evident in the admin interface when selecting a column header to sort on a column that is a foreign key in the model. When the model to which it refers has a Meta.ordering that is descending on a field, then the ordering logic failed because it failed to remove the leading minus sign in the SQL.

Patch included.

Attachments (1)

query_ordering.patch (693 bytes) - added by David S. <davidschein@…> 9 years ago.

Download all attachments as: .zip

Change History (7)

Changed 9 years ago by David S. <davidschein@…>


comment:1 Changed 9 years ago by Simon G. <dev@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:2 Changed 9 years ago by mtredinnick

  • Patch needs improvement set
  • Triage Stage changed from Ready for checkin to Accepted

People need to stop using rsplit() in patches. It doesn't work with Python 2.3. Triagers, please watch out for this.

I don't understand why the rsplit() is even needed here. I understand the checking for a hyphen on the column name, but not why you are expecting multiple dots in the table name. I don't believe a sequence like table1.table2.column_name is going to work in any case -- the SQL for the table joins will be wrong, won't it?

comment:3 Changed 9 years ago by anonymous

  • Cc None added
  • Component changed from Database wrapper to runserver
  • Keywords None added; ordering foreignkey removed
  • Summary changed from crash on sorting on foreign key with default ordering desc to None
  • Version changed from SVN to 0.91

comment:4 Changed 9 years ago by Ramiro Morales

  • Component changed from runserver to Database wrapper
  • Keywords ordering foreignkey added; None removed
  • Summary changed from None to crash on sorting on foreign key with default ordering desc
  • Version changed from 0.91 to SVN

Undo anonymous breakage of tickets

comment:5 Changed 9 years ago by gwilson

  • Resolution set to duplicate
  • Status changed from new to closed

duplicate of #2895.

comment:6 Changed 9 years ago by anonymous

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