summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-11-01 15:24:43 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-11-01 15:24:43 -0400
commit5d0e84434f116460d64d3078f650d9c89004f2a9 (patch)
tree5c4b2c11fcbd57233cdf91997993082c969a133c /lib/sqlalchemy/sql/compiler.py
parent931be6126718bbfc9a0bcf9ad92b535fb4273a0b (diff)
downloadsqlalchemy-5d0e84434f116460d64d3078f650d9c89004f2a9.tar.gz
- Fixed a regression introduced by the join rewriting feature of
:ticket:`2369` and :ticket:`2587` where a nested join with one side already an aliased select would fail to translate the ON clause on the outside correctly; in the ORM this could be seen when using a SELECT statement as a "secondary" table. [ticket:2858]
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r--lib/sqlalchemy/sql/compiler.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 2bf7d3f4a..4f3dbba36 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -1289,9 +1289,11 @@ class SQLCompiler(Compiled):
for c in selectable_.c:
c._key_label = c.key
c._label = c.name
+
translate_dict = dict(
- zip(right.element.c, selectable_.c)
- )
+ zip(newelem.right.element.c, selectable_.c)
+ )
+
translate_dict[right.element.left] = selectable_
translate_dict[right.element.right] = selectable_
@@ -1310,6 +1312,7 @@ class SQLCompiler(Compiled):
column_translate[-1].update(translate_dict)
newelem.right = selectable_
+
newelem.onclause = visit(newelem.onclause, **kw)
elif newelem.__visit_name__ is select_name:
column_translate.append({})