diff options
| author | Anssi Kääriäinen <akaariai@gmail.com> | 2013-08-22 10:42:10 +0300 |
|---|---|---|
| committer | Anssi Kääriäinen <akaariai@gmail.com> | 2013-08-22 10:59:59 +0300 |
| commit | 161e26c2ec9f88bf0395941aaa2fd193b110affd (patch) | |
| tree | c0249aa7372dc01d54a0f4f339a47d5e84d1b834 /django | |
| parent | 69a4594cb7b4eab7c689866557c491c85cdf3aa2 (diff) | |
[1.6.x] Fixed #20955 -- select_related regression
In cases where the same connection (from model A to model B along the
same field) was needed multiple times in a select_related query, the
join setup code mistakenly reused an existing join.
Backpatch of 8d65b6082c8bf5df25608d8733470879a8a61d7d.
Conflicts:
django/db/models/sql/compiler.py
tests/queries/tests.py
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/sql/compiler.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index f70750abed..e768cedf88 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -687,9 +687,8 @@ class SQLCompiler(object): # Use True here because we are looking at the _reverse_ side of # the relation, which is always nullable. new_nullable = True - table = model._meta.db_table - self.fill_related_selections(model._meta, table, cur_depth+1, - next, restricted, new_nullable) + self.fill_related_selections(model._meta, alias, cur_depth + 1, + next, restricted, new_nullable) def deferred_to_columns(self): """ |
