diff options
| author | Luke Plant <L.Plant.98@cantab.net> | 2011-05-05 20:26:26 +0000 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2011-05-05 20:26:26 +0000 |
| commit | db5807bdb1f242cc928e2fdf7110cb20af34790f (patch) | |
| tree | 8b8b0ae4ed2fdee324d483e8a3fa4baceece0dab /django/db/models/sql | |
| parent | 970ae0162012185e441aa4a204c0f8b381975a47 (diff) | |
Fixed #15823 - incorrect join condition when combining Q objects
Thanks to dcwatson for the excellent report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16159 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/sql')
| -rw-r--r-- | django/db/models/sql/query.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index c29673ecdd..9a5666b143 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -457,7 +457,11 @@ class Query(object): # An unused alias. continue promote = (rhs.alias_map[alias][JOIN_TYPE] == self.LOUTER) - new_alias = self.join(rhs.rev_join_map[alias], + lhs, table, lhs_col, col = rhs.rev_join_map[alias] + # If the left side of the join was already relabeled, use the + # updated alias. + lhs = change_map.get(lhs, lhs) + new_alias = self.join((lhs, table, lhs_col, col), (conjunction and not first), used, promote, not conjunction) used.add(new_alias) change_map[alias] = new_alias |
