Opened 11 years ago

Closed 10 years ago

Last modified 8 years ago

#3825 closed (duplicate)

crash on sorting on foreign key with default ordering desc

Reported by: David S. <davidschein@…> Owned by: Adrian Holovaty
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@…> 11 years ago.

Download all attachments as: .zip

Change History (7)

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

Attachment: query_ordering.patch added


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

Triage Stage: UnreviewedReady for checkin

comment:2 Changed 11 years ago by Malcolm Tredinnick

Patch needs improvement: set
Triage Stage: Ready for checkinAccepted

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 11 years ago by anonymous

Cc: None added
Component: Database runserver
Keywords: None added; ordering foreignkey removed
Summary: crash on sorting on foreign key with default ordering descNone
Version: SVN0.91

comment:4 Changed 11 years ago by Ramiro Morales

Component: runserverDatabase wrapper
Keywords: ordering foreignkey added; None removed
Summary: Nonecrash on sorting on foreign key with default ordering desc
Version: 0.91SVN

Undo anonymous breakage of tickets

comment:5 Changed 10 years ago by Gary Wilson

Resolution: duplicate
Status: newclosed

duplicate of #2895.

comment:6 Changed 10 years ago by anonymous

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