diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-01-19 02:19:38 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-01-19 02:19:38 +0000 |
commit | 37a61a1b497cb44d0098d188255238ddf4e8e38c (patch) | |
tree | 8c261eb58e9b9a6255046bfb05c782d1253fd997 /lib/sqlalchemy/sql.py | |
parent | 4309719ce017876b55929b021cdf2e536003f400 (diff) | |
download | sqlalchemy-37a61a1b497cb44d0098d188255238ddf4e8e38c.tar.gz |
- another fix to subquery correlation so that a subquery which has only one FROM
element will *not* correlate that single element, since at least one FROM element is
required in a query.
Diffstat (limited to 'lib/sqlalchemy/sql.py')
-rw-r--r-- | lib/sqlalchemy/sql.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql.py b/lib/sqlalchemy/sql.py index 323173cc5..dbd119fd1 100644 --- a/lib/sqlalchemy/sql.py +++ b/lib/sqlalchemy/sql.py @@ -1580,7 +1580,13 @@ class Select(_SelectBaseMixin, FromClause): else: return None - froms = property(lambda self: self.__froms.difference(self.__hide_froms).difference(self.__correlated), doc="""a collection containing all elements of the FROM clause""") + def _calc_froms(self): + f = self.__froms.difference(self.__hide_froms) + if (len(f) > 1): + return f.difference(self.__correlated) + else: + return f + froms = property(_calc_froms, doc="""a collection containing all elements of the FROM clause""") def accept_visitor(self, visitor): for f in self.froms: |