]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
render INSERT/UPDATE column expressions up front; pass state
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 8 Aug 2020 17:03:17 +0000 (13:03 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 8 Aug 2020 17:34:27 +0000 (13:34 -0400)
commitc0685e5f419e203acd5e46f25c90e851e30e6f03
tree42b73a6205a8b03e2ba232c21e43d5affb8657d2
parent302e8dee82718df6c3a46de4c5283bdae51a650a
render INSERT/UPDATE column expressions up front; pass state

Fixes related to rendering of complex UPDATE DML
which was not correctly preserving positional parameter
order in conjunction with DML features that are only known
to work on the PostgreSQL database.    Both pg8000
and asyncpg use positional parameters which is why these
issues are suddenly apparent.

crud.py now takes on the task of rendering the column
expressions for SET or VALUES so that for the very unusual
case that the column expression is a compound expression
that includes a bound parameter (namely an array index),
the bound parameter order is preserved.

Additionally, crud.py passes through the positional_names
keyword argument into bindparam_string() which is necessary
when CTEs are being rendered, as PG supports complex
CTE / INSERT / UPDATE scenarios.

Change-Id: I7f03920500e19b721636b84594de78a5bfdcbc82
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/crud.py
lib/sqlalchemy/sql/dml.py
test/sql/test_update.py