2011/12/11 Michael Bayer <mike...@zzzcomputing.com>

> My impression was Postgresql handles this much more nicely which is
> confirmed by this post:
>
> http://beerpla.net/2009/02/17/swapping-column-values-in-mysql/
>
> the usual way this kind of thing is done is via declaring local variables
> in the SQL statement, and an example of doing such using MySQL's syntax is
> in that linked article - MySQL will let you assign to the variable in the
> WHERE clause so they do "update t set a=b, b=@temp where (@temp:=a) is not
> null".   This basically gets at the value of "a" before it changes, which
> is what PG does in any case.
>
> None of this has much to do with SQLAlchemy, though.   you'd pretty much
> need to use a plain string or @compiles elements to produce that SQL within
> SQLAlchemy.
>

I know about correct behavior of postgresql in this task. And I was very
surprising when found such "weird" behavior of mysql.
Is this a bug in mysql? What tell sql standard about such operations?

PS For now I made switch of column values in client code, by doing "select
for update ..." and update each row of result.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to