summaryrefslogtreecommitdiff
path: root/test/sql/test_update.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_update.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_update.py')
-rw-r--r--test/sql/test_update.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/sql/test_update.py b/test/sql/test_update.py
index 8eccde999..f900a164c 100644
--- a/test/sql/test_update.py
+++ b/test/sql/test_update.py
@@ -157,6 +157,31 @@ class UpdateFromRoundTripTest(_UpdateFromTestBase, fixtures.TablesTest):
)
@testing.requires.update_from
+ def test_exec_two_table_plus_alias(self):
+ users, addresses = self.tables.users, self.tables.addresses
+ a1 = addresses.alias()
+
+ testing.db.execute(
+ addresses.update().\
+ values(email_address=users.c.name).\
+ where(users.c.id==a1.c.user_id).\
+ where(users.c.name=='ed').\
+ where(a1.c.id==addresses.c.id)
+ )
+ eq_(
+ testing.db.execute(
+ addresses.select().\
+ order_by(addresses.c.id)).fetchall(),
+ [
+ (1, 7, 'x', "jack@bean.com"),
+ (2, 8, 'x', "ed"),
+ (3, 8, 'x', "ed"),
+ (4, 8, 'x', "ed"),
+ (5, 9, 'x', "fred@fred.com")
+ ]
+ )
+
+ @testing.requires.update_from
def test_exec_three_table(self):
users, addresses, dingalings = \
self.tables.users, \