summaryrefslogtreecommitdiff
path: root/test/sql/test_compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2016-03-21 10:57:40 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2016-03-21 10:57:40 -0400
commit07a4b6cbcda6e6ee6e67893c5a5d2fd01e5f125f (patch)
treea28aac49f1f8fd7aef5ae3ed85a2bd9ce98978d1 /test/sql/test_compiler.py
parent732c613eeb890e7b7cbd04750468dac584151a31 (diff)
downloadsqlalchemy-07a4b6cbcda6e6ee6e67893c5a5d2fd01e5f125f.tar.gz
- Fixed bug where the negation of an EXISTS expression would not
be properly typed as boolean in the result, and also would fail to be anonymously aliased in a SELECT list as is the case with a non-negated EXISTS construct. fixes #3682
Diffstat (limited to 'test/sql/test_compiler.py')
-rw-r--r--test/sql/test_compiler.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py
index 8e75638a2..66612eb33 100644
--- a/test/sql/test_compiler.py
+++ b/test/sql/test_compiler.py
@@ -638,6 +638,21 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL):
"myothertable.otherid = :otherid_2)) AS anon_1"
)
+ self.assert_compile(
+ select([exists([1])]),
+ "SELECT EXISTS (SELECT 1) AS anon_1"
+ )
+
+ self.assert_compile(
+ select([~exists([1])]),
+ "SELECT NOT (EXISTS (SELECT 1)) AS anon_1"
+ )
+
+ self.assert_compile(
+ select([~(~exists([1]))]),
+ "SELECT NOT (NOT (EXISTS (SELECT 1))) AS anon_1"
+ )
+
def test_where_subquery(self):
s = select([addresses.c.street], addresses.c.user_id
== users.c.user_id, correlate=True).alias('s')