From 5d0e84434f116460d64d3078f650d9c89004f2a9 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 1 Nov 2013 15:24:43 -0400 Subject: - 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] --- lib/sqlalchemy/sql/compiler.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy/sql/compiler.py') 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({}) -- cgit v1.2.1