summaryrefslogtreecommitdiff
path: root/test/sql/test_compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-04-18 19:52:58 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2012-04-18 19:52:58 -0400
commit541e59c3d7c141cfe532b26b5fbf4b8a8d30b841 (patch)
treecb390b3341ddd4a0fdbd21646a7ee54f150b9b95 /test/sql/test_compiler.py
parentfdda4b0e018f8c1a869411b7ed31387ea90cb082 (diff)
downloadsqlalchemy-541e59c3d7c141cfe532b26b5fbf4b8a8d30b841.tar.gz
- [bug] UPDATE..FROM syntax with SQL Server
requires that the updated table be present in the FROM clause when an alias of that table is also present in the FROM clause. The updated table is now always present in the FROM, when FROM is present in the first place. Courtesy sayap. [ticket:2468]
Diffstat (limited to 'test/sql/test_compiler.py')
-rw-r--r--test/sql/test_compiler.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py
index c3cf001fa..feb7405db 100644
--- a/test/sql/test_compiler.py
+++ b/test/sql/test_compiler.py
@@ -2926,6 +2926,19 @@ class CRUDTest(fixtures.TestBase, AssertsCompiledSQL):
"UPDATE mytable SET name=:name "
"FROM myothertable WHERE myothertable.otherid = mytable.myid")
+ self.assert_compile(u,
+ "UPDATE mytable SET name=:name "
+ "FROM mytable, myothertable WHERE "
+ "myothertable.otherid = mytable.myid",
+ dialect=mssql.dialect())
+
+ self.assert_compile(u.where(table2.c.othername == mt.c.name),
+ "UPDATE mytable SET name=:name "
+ "FROM mytable, myothertable, mytable AS mytable_1 "
+ "WHERE myothertable.otherid = mytable.myid "
+ "AND myothertable.othername = mytable_1.name",
+ dialect=mssql.dialect())
+
def test_delete(self):
self.assert_compile(
delete(table1, table1.c.myid == 7),