summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-04-30 19:06:26 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-04-30 19:06:26 -0400
commit5da667e017276f6dc48aa8698c899f6abae0f6ca (patch)
treee98fee6f25c9718f8f0eaa2f80f42d043ce2c9d7 /lib/sqlalchemy/sql/compiler.py
parent6022ac3097f6389226d50ec2555d9029dbbffef4 (diff)
downloadsqlalchemy-konsta_3022.tar.gz
- Fixed bug where the combination of "limit" rendering askonsta_3022
"SELECT FIRST n ROWS" using a bound parameter (only firebird has both), combined with column-level subqueries which also feature "limit" as well as "positional" bound parameters (e.g. qmark style) would erroneously assign the subquery-level positions before that of the enclosing SELECT, thus returning parameters which are out of order. Fixes #3038
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r--lib/sqlalchemy/sql/compiler.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 31193ab17..080fb43f9 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -1481,19 +1481,6 @@ class SQLCompiler(Compiled):
'within_columns_clause': False
})
- # the actual list of columns to print in the SELECT column list.
- inner_columns = [
- c for c in [
- self._label_select_column(select,
- column,
- populate_result_map, asfrom,
- column_clause_args,
- name=name)
- for name, column in select._columns_plus_names
- ]
- if c is not None
- ]
-
text = "SELECT " # we're off to a good start !
if select._hints:
@@ -1514,6 +1501,20 @@ class SQLCompiler(Compiled):
text += self._generate_prefixes(select, select._prefixes, **kwargs)
text += self.get_select_precolumns(select)
+
+ # the actual list of columns to print in the SELECT column list.
+ inner_columns = [
+ c for c in [
+ self._label_select_column(select,
+ column,
+ populate_result_map, asfrom,
+ column_clause_args,
+ name=name)
+ for name, column in select._columns_plus_names
+ ]
+ if c is not None
+ ]
+
text += ', '.join(inner_columns)
if froms: