summaryrefslogtreecommitdiff
path: root/test/sql/test_compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2015-04-20 19:21:00 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2015-04-20 19:21:00 -0400
commit3e80d628bd133d0fd0687e35b8d13abd1d31d6df (patch)
treebd6048a551077731253c51d68bb3c124589f82fe /test/sql/test_compiler.py
parent2c91f71776006968c091b683ea5f187dfaca72df (diff)
downloadsqlalchemy-3e80d628bd133d0fd0687e35b8d13abd1d31d6df.tar.gz
- Fixed issue where a straight SELECT EXISTS query would fail to
assign the proper result type of Boolean to the result mapping, and instead would leak column types from within the query into the result map. This issue exists in 0.9 and earlier as well, however has less of an impact in those versions. In 1.0, due to #918 this becomes a regression in that we now rely upon the result mapping to be very accurate, else we can assign result-type processors to the wrong column. In all versions, this issue also has the effect that a simple EXISTS will not apply the Boolean type handler, leading to simple 1/0 values for backends without native boolean instead of True/False. The fix includes that an EXISTS columns argument will be anon-labeled like other column expressions; a similar fix is implemented for pure-boolean expressions like ``not_(True())``. fixes #3372
Diffstat (limited to 'test/sql/test_compiler.py')
-rw-r--r--test/sql/test_compiler.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py
index 4bdd9fcdc..75f9a7c82 100644
--- a/test/sql/test_compiler.py
+++ b/test/sql/test_compiler.py
@@ -380,7 +380,7 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL):
# this is native_boolean=False for default dialect
self.assert_compile(
select([not_(True)], use_labels=True),
- "SELECT :param_1 = 0"
+ "SELECT :param_1 = 0 AS anon_1"
)
self.assert_compile(
@@ -561,13 +561,13 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL):
self.assert_compile(exists([table1.c.myid], table1.c.myid
== 5).select(),
'SELECT EXISTS (SELECT mytable.myid FROM '
- 'mytable WHERE mytable.myid = :myid_1)',
+ 'mytable WHERE mytable.myid = :myid_1) AS anon_1',
params={'mytable_myid': 5})
self.assert_compile(select([table1, exists([1],
from_obj=table2)]),
'SELECT mytable.myid, mytable.name, '
'mytable.description, EXISTS (SELECT 1 '
- 'FROM myothertable) FROM mytable',
+ 'FROM myothertable) AS anon_1 FROM mytable',
params={})
self.assert_compile(select([table1,
exists([1],