summaryrefslogtreecommitdiff
path: root/test/sql/test_text.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2015-03-23 12:33:48 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2015-03-23 12:33:48 -0400
commit04545727d4117db51786189e591b1777bde1a40b (patch)
tree16aa1a338c6529096db92d0d1efec1f057a28088 /test/sql/test_text.py
parentdb853306c40437a8ad3dc9f510865820a941c3b5 (diff)
downloadsqlalchemy-04545727d4117db51786189e591b1777bde1a40b.tar.gz
- Fixed bug in new "label resolution" feature of :ticket:`2992` where
a label that was anonymous, then labeled again with a name, would fail to be locatable via a textual label. This situation occurs naturally when a mapped :func:`.column_property` is given an explicit label in a query. fixes #3340
Diffstat (limited to 'test/sql/test_text.py')
-rw-r--r--test/sql/test_text.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/sql/test_text.py b/test/sql/test_text.py
index 4483597ac..1c3cb0cb4 100644
--- a/test/sql/test_text.py
+++ b/test/sql/test_text.py
@@ -574,6 +574,15 @@ class OrderByLabelResolutionTest(fixtures.TestBase, AssertsCompiledSQL):
"FROM mytable AS mytable_1 ORDER BY mytable_1.name"
)
+ def test_order_by_named_label_from_anon_label(self):
+ s1 = select([table1.c.myid.label(None).label("foo"), table1.c.name])
+ stmt = s1.order_by("foo")
+ self.assert_compile(
+ stmt,
+ "SELECT mytable.myid AS foo, mytable.name "
+ "FROM mytable ORDER BY foo"
+ )
+
def test_order_by_outermost_label(self):
# test [ticket:3335], assure that order_by("foo")
# catches the label named "foo" in the columns clause only,