summaryrefslogtreecommitdiff
path: root/django/db/models/sql
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-07-27 18:16:17 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-07-27 18:16:17 +0000
commit4fee39c63ce781e7af827feeabcc911080d81edc (patch)
tree30dd7fd84648aeb5b8f7c7354c0fbdea57dd6b2f /django/db/models/sql
parent4774c8d6739da02a7890f1ff80a87b6ca87821a7 (diff)
Fixed #7872 -- Fixed a missed case of promoting table joins when using
disjunctive filters. Thanks to Michael Radziej for the failing test case. problem. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8107 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/sql')
-rw-r--r--django/db/models/sql/query.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 2577b57a33..93a779e591 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -1089,20 +1089,23 @@ class Query(object):
join_it = iter(join_list)
table_it = iter(self.tables)
join_it.next(), table_it.next()
+ table_promote = False
for join in join_it:
table = table_it.next()
if join == table and self.alias_refcount[join] > 1:
continue
- self.promote_alias(join)
+ join_promote = self.promote_alias(join)
if table != join:
- self.promote_alias(table)
+ table_promote = self.promote_alias(table)
break
for join in join_it:
- self.promote_alias(join)
+ if self.promote_alias(join, join_promote):
+ join_promote = True
for table in table_it:
# Some of these will have been promoted from the join_list, but
# that's harmless.
- self.promote_alias(table)
+ if self.promote_alias(table, table_promote):
+ table_promote = True
self.where.add((alias, col, field, lookup_type, value), connector)