bound parameters in UPDATE..FROM are subject to mis-ordering
Issue #2768
resolved
this is a funny one:
from sqlalchemy.sql import table, column, select
from sqlalchemy.dialects import mysql
t1 = table('t1', column('x'))
t2 = table('t2', column('y'), column('z'))
subq = select([t2](t2)).where(t2.c.y == 7).alias()
stmt = t1.update().values(x=5).where(t1.c.x == subq.c.z)
compiled = stmt.compile(dialect=mysql.dialect())
# default impl, UPDATE..FROM . y follows x
print stmt
# mysql impl, UPDATE A, B, x follows y
print compiled
# but still getting y follows x
print compiled.positiontup
that is:
UPDATE t1 SET x=:x FROM (SELECT t2.y AS y, t2.z AS z
FROM t2
WHERE t2.y = :y_1) AS anon_1 WHERE t1.x = anon_1.z
UPDATE t1, (SELECT t2.y AS y, t2.z AS z
FROM t2
WHERE t2.y = %s) AS anon_1 SET t1.x=%s WHERE t1.x = anon_1.z
[u'y_1']('x',)
Comments (3)
-
reporter -
reporter - changed status to resolved
-
reporter - removed milestone
Removing milestone: 0.8.xx (automated comment)
- Log in to comment
OK very easy:
more of a test: