diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-11-29 22:13:58 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-11-29 22:13:58 +0000 |
| commit | 13d989b2d0064b00c4b231c9d90bf4a2a6dfd56a (patch) | |
| tree | 348f031172cb1de8ccc9887badd2a1b8fd2e1725 /test/sql | |
| parent | 6bba73a9f3bd10e23ceaf14349ef10978b7eb5df (diff) | |
| download | sqlalchemy-13d989b2d0064b00c4b231c9d90bf4a2a6dfd56a.tar.gz | |
- sending a selectable to an IN no longer creates a "union" out of multiple
selects; only one selectable to an IN is allowed now (make a union yourself
if union is needed; explicit better than implicit, dont guess, etc.)
Diffstat (limited to 'test/sql')
| -rw-r--r-- | test/sql/select.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/sql/select.py b/test/sql/select.py index 1c8927e6b..c422c63fb 100644 --- a/test/sql/select.py +++ b/test/sql/select.py @@ -572,6 +572,18 @@ FROM mytable, myothertable WHERE mytable.myid = myothertable.otherid AND mytable self.runtest(select([table1], ~table1.c.myid.in_(select([table2.c.otherid]))), "SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE mytable.myid NOT IN (SELECT myothertable.otherid AS otherid FROM myothertable)") + + # test that putting a select in an IN clause does not blow away its ORDER BY clause + self.runtest( + select([table1, table2], + table2.c.otherid.in_( + select([table2.c.otherid], order_by=[table2.c.othername], limit=10, correlate=False) + ), + from_obj=[table1.join(table2, table1.c.myid==table2.c.otherid)], order_by=[table1.c.myid] + ), + "SELECT mytable.myid, mytable.name, mytable.description, myothertable.otherid, myothertable.othername FROM mytable JOIN myothertable ON mytable.myid = myothertable.otherid WHERE myothertable.otherid IN (SELECT myothertable.otherid AS otherid FROM myothertable ORDER BY myothertable.othername LIMIT 10) ORDER BY mytable.myid" + ) + def testlateargs(self): """tests that a SELECT clause will have extra "WHERE" clauses added to it at compile time if extra arguments |
