diff options
Diffstat (limited to 'test/sql/select.py')
-rw-r--r-- | test/sql/select.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/sql/select.py b/test/sql/select.py index 24cff7702..b8d1f4f68 100644 --- a/test/sql/select.py +++ b/test/sql/select.py @@ -141,7 +141,16 @@ sq.myothertable_othername AS sq_myothertable_othername FROM (" + sqstring + ") A def test_dont_overcorrelate(self): self.assert_compile(select([table1], from_obj=[table1, table1.select()]), """SELECT mytable.myid, mytable.name, mytable.description FROM mytable, (SELECT mytable.myid AS myid, mytable.name AS name, mytable.description AS description FROM mytable)""") + + def test_intentional_full_correlate(self): + """test a subquery that has no FROM clause.""" + + t = table('t', column('a'), column('b')) + s = select([t.c.a]).where(t.c.a==1).correlate(t).as_scalar() + s2 = select([t.c.a, s]) + self.assert_compile(s2, """SELECT t.a, (SELECT t.a WHERE t.a = :t_a_1) AS anon_1 FROM t""") + def test_exists(self): self.assert_compile(exists([table1.c.myid], table1.c.myid==5).select(), "SELECT EXISTS (SELECT mytable.myid FROM mytable WHERE mytable.myid = :mytable_myid_1)", params={'mytable_myid':5}) |