From f9dc30f239d1aa13771f0e152af691a8ae56514b Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 24 Jun 2007 18:46:02 +0000 Subject: [PATCH] added test for correlation of scalar subqueries to a JOIN object --- test/sql/select.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/sql/select.py b/test/sql/select.py index 37c597a8c8..01fbd5cc85 100644 --- a/test/sql/select.py +++ b/test/sql/select.py @@ -175,6 +175,7 @@ sq.myothertable_othername AS sq_myothertable_othername FROM (" + sqstring + ") A s, "SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE EXISTS (SELECT 1 FROM myothertable WHERE myothertable.otherid = mytable.myid)" ) + def testorderbysubquery(self): self.runtest( @@ -223,6 +224,12 @@ sq.myothertable_othername AS sq_myothertable_othername FROM (" + sqstring + ") A ) self.runtest(q, "SELECT places.id, places.nm, main_zip.zipcode, latlondist((SELECT zips.latitude FROM zips WHERE zips.zipcode = main_zip.zipcode), (SELECT zips.longitude FROM zips WHERE zips.zipcode = main_zip.zipcode)) AS dist FROM places, zips AS main_zip ORDER BY dist, places.nm") + a1 = table2.alias('t2alias') + s1 = select([a1.c.otherid], table1.c.myid==a1.c.otherid, scalar=True) + j1 = table1.join(table2, table1.c.myid==table2.c.otherid) + s2 = select([table1, s1], from_obj=[j1]) + self.runtest(s2, "SELECT mytable.myid, mytable.name, mytable.description, (SELECT t2alias.otherid FROM myothertable AS t2alias WHERE mytable.myid = t2alias.otherid) FROM mytable JOIN myothertable ON mytable.myid = myothertable.otherid") + def testlabelcomparison(self): x = func.lala(table1.c.myid).label('foo') self.runtest(select([x], x==5), "SELECT lala(mytable.myid) AS foo FROM mytable WHERE lala(mytable.myid) = :literal") -- 2.47.2