From 0c9d55db73776d12a6898929092a42e586f3c4bf Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 22 Oct 2012 13:29:12 -0400 Subject: The auto-correlation feature of :func:`.select`, and by proxy that of :class:`.orm.Query`, will not take effect for a SELECT statement that is being rendered directly in the FROM list of the enclosing SELECT. Correlation in SQL only applies to column expressions such as those in the WHERE, ORDER BY, columns clause. [ticket:2595] --- lib/sqlalchemy/sql/compiler.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/sql/compiler.py') diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 5fe30a8ff..6da51c31c 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -1072,7 +1072,12 @@ class SQLCompiler(engine.Compiled): positional_names=None, **kwargs): entry = self.stack and self.stack[-1] or {} - existingfroms = entry.get('from', None) + if not asfrom: + existingfroms = entry.get('from', None) + else: + # don't render correlations if we're rendering a FROM list + # entry + existingfroms = [] froms = select._get_display_froms(existingfroms) -- cgit v1.2.1