diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-06-12 20:35:37 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-06-12 20:35:37 -0400 |
commit | eaa7aa4239af4f42cdb8b370120d1538c6704d6b (patch) | |
tree | 6feae048956d33afb6f09ab28478079b1c4410ec /lib/sqlalchemy/sql/expression.py | |
parent | d326fe639ba3bb938a1db5c99de94a6ddfc030e5 (diff) | |
download | sqlalchemy-eaa7aa4239af4f42cdb8b370120d1538c6704d6b.tar.gz |
- Fixed bug whereby comparison of column
expression to a Query() would not call
as_scalar() on the underlying SELECT
statement to produce a scalar subquery,
in the way that occurs if you called
it on Query().subquery(). [ticket:2190]
- some cleanup to test.orm.test_query
Diffstat (limited to 'lib/sqlalchemy/sql/expression.py')
-rw-r--r-- | lib/sqlalchemy/sql/expression.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index 8eb552de9..f78015ac2 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -1943,7 +1943,10 @@ class _CompareMixin(ColumnOperators): other.type = self.type return other elif hasattr(other, '__clause_element__'): - return other.__clause_element__() + other = other.__clause_element__() + if isinstance(other, (_SelectBase, Alias)): + other = other.as_scalar() + return other elif not isinstance(other, ClauseElement): return self._bind_param(operator, other) elif isinstance(other, (_SelectBase, Alias)): |