]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
downgrade batches for bindparam() in SET
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 17 Feb 2026 20:58:22 +0000 (15:58 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 17 Feb 2026 21:11:09 +0000 (16:11 -0500)
commitb481c9ae9cf5887e313baed5c8fb4701528806ef
tree615956746406ceede690c20bc05bb1eb7cf93926
parentdf14d2796c9aa4ae3647cf0a1e797966e8238545
downgrade batches for bindparam() in SET

Fixed issue where :meth:`_postgresql.Insert.on_conflict_do_update`
using parametrized bound parameters in the ``set_`` clause would fail
when used with executemany batching. For dialects that use the
``use_insertmanyvalues_wo_returning`` optimization (psycopg2),
insertmanyvalues is now disabled when there is an ON CONFLICT clause.
For cases with RETURNING, row-at-a-time mode is used when the SET
clause contains parametrized bindparams (bindparams that receive
values from the parameters dict), ensuring each row's parameters are
correctly applied. ON CONFLICT statements using expressions like
``excluded.<column>`` continue to batch normally.

Fixed issue where :meth:`_sqlite.Insert.on_conflict_do_update`
using parametrized bound parameters in the ``set_`` clause would fail
when used with executemany batching. Row-at-a-time mode is now used
for ON CONFLICT statements with RETURNING that contain parametrized
bindparams, ensuring each row's parameters are correctly applied. ON
CONFLICT statements using expressions like ``excluded.<column>``
continue to batch normally.

Fixes: #13130
Change-Id: I0c5a9142401c745d38e58d071c16e53610f9bfea
(cherry picked from commit 5b2e7aae01cc2e55e68a8445569ee709b17715dd)
doc/build/changelog/unreleased_20/13130.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/postgresql/base.py
lib/sqlalchemy/dialects/sqlite/base.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/crud.py
test/dialect/postgresql/test_on_conflict.py
test/dialect/sqlite/test_on_conflict.py