diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-01-25 00:35:28 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-01-25 00:35:28 +0000 |
| commit | 67e7f45c59016fe15f055be4fb1e2abdecf0cec8 (patch) | |
| tree | 516931641aea6ae3117f1e5d29f884eafa668709 /lib/sqlalchemy/sql | |
| parent | c0835ffdc26e8abe7061ce41f6410e613052469f (diff) | |
| download | sqlalchemy-67e7f45c59016fe15f055be4fb1e2abdecf0cec8.tar.gz | |
- union(), intersect(), except() and other "compound" types
of statements have more consistent behavior w.r.t.
parenthesizing. Each compound element embedded within
another will now be grouped with parenthesis - previously,
the first compound element in the list would not be grouped,
as SQLite doesn't like a statement to start with
parenthesis. However, Postgresql in particular has
precedence rules regarding INTERSECT, and it is
more consistent for parenthesis to be applied equally
to all sub-elements. So now, the workaround for SQLite
is also what the workaround for PG was previously -
when nesting compound elements, the first one usually needs
".alias().select()" called on it to wrap it inside
of a subquery. [ticket:1665]
Diffstat (limited to 'lib/sqlalchemy/sql')
| -rw-r--r-- | lib/sqlalchemy/sql/expression.py | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index eb64fd571..cf5d98d8f 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -3362,11 +3362,7 @@ class CompoundSelect(_SelectBaseMixin, FromClause): (1, len(self.selects[0].c), n+1, len(s.c)) ) - # unions group from left to right, so don't group first select - if n: - self.selects.append(s.self_group(self)) - else: - self.selects.append(s) + self.selects.append(s.self_group(self)) _SelectBaseMixin.__init__(self, **kwargs) |
