1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

queryset-refactor: Fixed the optimization that potentially removes the final

join to handle the case where a to_field attribute is given for the join.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6495 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick
2007-10-14 02:15:52 +00:00
parent 425e4662a4
commit 240ecf0811
2 changed files with 15 additions and 17 deletions

View File

@@ -128,19 +128,15 @@ Bug #2253
>>> (q1 & q2).order_by('name')
[<Item: one>]
Bugs #4088 & #4306
Bugs #4088, #4306
>>> Report.objects.filter(creator=1001)
[<Report: r1>]
>>> Report.objects.filter(creator__num=1001)
[<Report: r1>]
# FIXME: The "removing final pk comparison" optimization is biting us here.
# Need to only remove it if the join was also on the pk value.
# >>> Report.objects.filter(creator__id=1001)
# []
# >>> Report.objects.filter(creator__id=a1.id)
# [<Report: r1>]
>>> Report.objects.filter(creator__id=1001)
[]
>>> Report.objects.filter(creator__id=a1.id)
[<Report: r1>]
>>> Report.objects.filter(creator__name='a1')
[<Report: r1>]