feature from :ticket:`1068` would not apply quoting rules to the
label name as rendered in the ORDER BY.
fix #3020, re: #1068
.. changelog::
:version: 0.9.5
+ .. change::
+ :tags: bug, sql
+ :tickets: 3020, 1068
+
+ Fixed regression introduced in 0.9 where new "ORDER BY <labelname>"
+ feature from :ticket:`1068` would not apply quoting rules to the
+ label name as rendered in the ORDER BY.
+
.. change::
:tags: feature, orm
:tickets: 3017
OPERATORS[operators.as_] + \
self.preparer.format_label(label, labelname)
elif render_label_only:
- return labelname
+ return self.preparer.format_label(label, labelname)
else:
return label.element._compiler_dispatch(self,
within_columns_clause=False,
'"Anon".Col1 = :Col1_1'
)
+ def test_simple_order_by_label(self):
+ m = MetaData()
+ t1 = Table('t1', m, Column('col1', Integer))
+ cl = t1.c.col1.label('ShouldQuote')
+ self.assert_compile(
+ select([cl]).order_by(cl),
+ 'SELECT t1.col1 AS "ShouldQuote" FROM t1 ORDER BY "ShouldQuote"'
+ )
+
def test_join(self):
# Lower case names, should not quote
metadata = MetaData()