summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-03-23 20:41:40 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-03-23 20:41:40 -0400
commit1321db6473a45517bbb86203e9cbdd4c02fa8ac0 (patch)
tree5671282a2c9bebb99c594a8b5cfbe677d182d6f2 /lib/sqlalchemy/sql
parent0a556d322029651be9018a1b41f13e23edf18388 (diff)
downloadsqlalchemy-1321db6473a45517bbb86203e9cbdd4c02fa8ac0.tar.gz
- Fixed bug introduced in 0.6beta2 where column labels would
render inside of column expressions already assigned a label. [ticket:1747]
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/compiler.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 4e9175ae8..75b3f79f0 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -305,11 +305,13 @@ class SQLCompiler(engine.Compiled):
def visit_grouping(self, grouping, asfrom=False, **kwargs):
return "(" + self.process(grouping.element, **kwargs) + ")"
- def visit_label(self, label, result_map=None, within_columns_clause=False, **kw):
+ def visit_label(self, label, result_map=None,
+ within_label_clause=False,
+ within_columns_clause=False, **kw):
# only render labels within the columns clause
# or ORDER BY clause of a select. dialect-specific compilers
# can modify this behavior.
- if within_columns_clause:
+ if within_columns_clause and not within_label_clause:
labelname = isinstance(label.name, sql._generated_label) and \
self._truncated_identifier("colident", label.name) or label.name
@@ -318,13 +320,14 @@ class SQLCompiler(engine.Compiled):
(label.name, (label, label.element, labelname), label.element.type)
return self.process(label.element,
- within_columns_clause=within_columns_clause,
+ within_columns_clause=True,
+ within_label_clause=True,
**kw) + \
OPERATORS[operators.as_] + \
self.preparer.format_label(label, labelname)
else:
return self.process(label.element,
- within_columns_clause=within_columns_clause,
+ within_columns_clause=False,
**kw)
def visit_column(self, column, result_map=None, **kwargs):