summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine/default.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-01-25 00:35:28 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2010-01-25 00:35:28 +0000
commit67e7f45c59016fe15f055be4fb1e2abdecf0cec8 (patch)
tree516931641aea6ae3117f1e5d29f884eafa668709 /lib/sqlalchemy/engine/default.py
parentc0835ffdc26e8abe7061ce41f6410e613052469f (diff)
downloadsqlalchemy-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/engine/default.py')
-rw-r--r--lib/sqlalchemy/engine/default.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py
index 6db655832..e168a5465 100644
--- a/lib/sqlalchemy/engine/default.py
+++ b/lib/sqlalchemy/engine/default.py
@@ -268,8 +268,9 @@ class DefaultExecutionContext(base.ExecutionContext):
self.isinsert = compiled.isinsert
self.isupdate = compiled.isupdate
self.isdelete = compiled.isdelete
- self.execution_options =\
- compiled.statement._execution_options.union(self.execution_options)
+ if compiled.statement._execution_options:
+ self.execution_options =\
+ compiled.statement._execution_options.union(self.execution_options)
if not parameters:
self.compiled_parameters = [compiled.construct_params()]