summaryrefslogtreecommitdiff
path: root/django/db/models/sql
diff options
context:
space:
mode:
authorAnssi Kääriäinen <anssi.kaariainen@thl.fi>2015-04-16 08:39:31 +0300
committerTim Graham <timograham@gmail.com>2015-04-16 09:22:00 -0400
commit355c5edd9390caad5725375abca03460805f663b (patch)
tree9f0675086c93bd49a7dfd99f8389bd5947623239 /django/db/models/sql
parent8ca9bc5ec326c0b01634dac264a9ba6f0857483e (diff)
Fixed #24605 -- Fixed incorrect reference to alias in subquery.
Thanks to charettes and priidukull for investigating the issue, and to kurevin for the report.
Diffstat (limited to 'django/db/models/sql')
-rw-r--r--django/db/models/sql/compiler.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py
index 1ca56d60f1..b70a15755b 100644
--- a/django/db/models/sql/compiler.py
+++ b/django/db/models/sql/compiler.py
@@ -347,7 +347,8 @@ class SQLCompiler(object):
if name in self.quote_cache:
return self.quote_cache[name]
if ((name in self.query.alias_map and name not in self.query.table_map) or
- name in self.query.extra_select or name in self.query.external_aliases):
+ name in self.query.extra_select or (
+ name in self.query.external_aliases and name not in self.query.table_map)):
self.quote_cache[name] = name
return name
r = self.connection.ops.quote_name(name)