Opened 12 years ago
Last modified 11 years ago
#19195 closed Bug
Using distinct([*fields]) filter on a foreign key produces an ordering error when the foreign key has a Meta ordering field. — at Initial Version
Description ¶
I tried to using a distinct filter like this: Appearance.objects.order_by('team').distinct('team'); this fails with the following Database Error: "DatabaseError: SELECT DISTINCT ON expressions must match initial ORDER BY expressions"
It is possible to work around this problem by using this modified filter: Appearance.objects.order_by('teamid').distinct('teamid').
Model definition: http://pastebin.com/index/J45fy9fr
Full traceback: http://pastebin.com/feSFMbzX
Note:
See TracTickets
for help on using tickets.