]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
fix ORM support for column-named bindparam() in crud .values()
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 10 Jan 2023 14:51:23 +0000 (09:51 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 11 Jan 2023 16:47:02 +0000 (11:47 -0500)
commite636917a721f4bb01264a23736c9c81e462863cb
treef039595c1eb6f06865ee9a67b77011b035dd2561
parenta950402dae2a5b2448f5f4235946b2f767c7485c
fix ORM support for column-named bindparam() in crud .values()

Fixed bug / regression where using :func:`.bindparam()` with the same name
as a column in the :meth:`.Update.values` method of :class:`.Update`, as
well as the :meth:`.Insert.values` method of :class:`.Insert` in 2.0 only,
would in some cases silently fail to honor the SQL expression in which the
parameter were presented, replacing the expression with a new parameter of
the same name and discarding any other elements of the SQL expression, such
as SQL functions, etc. The specific case would be statements that were
constructed against ORM entities rather than plain :class:`.Table`
instances, but would occur if the statement were invoked with a
:class:`.Session` or a :class:`.Connection`.

:class:`.Update` part of the issue was present in both 2.0 and 1.4 and is
backported to 1.4.

Fixes: #9075
Change-Id: Ie954bc1f492ec6a566163588182ef4910c7ee452
doc/build/changelog/unreleased_14/9075.rst [new file with mode: 0644]
lib/sqlalchemy/sql/crud.py
test/orm/test_core_compilation.py
test/sql/test_compiler.py
test/sql/test_insert.py
test/sql/test_update.py