From 4fee39c63ce781e7af827feeabcc911080d81edc Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Sun, 27 Jul 2008 18:16:17 +0000 Subject: 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 --- django/db/models/sql/query.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'django/db/models/sql') 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) -- cgit v1.3