]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
run sentinel server side fns outside of VALUES
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 1 Dec 2025 20:11:50 +0000 (15:11 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 3 Dec 2025 03:53:17 +0000 (22:53 -0500)
commit40c07b00534f623665a9933a3583d439f3ee8d6b
tree3a00c4dde2d1970b36345e0cf65685508be1fdf3
parentc07a255b76477647a9733fd3c73f643878364e5e
run sentinel server side fns outside of VALUES

Fixed the structure of the SQL string used for the
:ref:`engine_insertmanyvalues` feature when an explicit sequence with
``nextval()`` is used. The SQL function invocation for the sequence has
been moved from being rendered inline within each tuple inside of VALUES to
being rendered once in the SELECT that reads from VALUES. This change
ensures the function is invoked in the correct order as rows are processed,
rather than assuming PostgreSQL will execute inline function calls within
VALUES in a particular order. While current PostgreSQL versions appear to
handle the previous approach correctly, the database does not guarantee
this behavior for future versions.

Fixes: #13015
Change-Id: Ia0a2a4e8f89e21852d7cb550dfa5d9ea9447b590
(cherry picked from commit c5d09f5ed4b4e37cfdd033026e2f67382ee9fcb3)
doc/build/changelog/unreleased_20/13015.rst [new file with mode: 0644]
lib/sqlalchemy/engine/base.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/crud.py
lib/sqlalchemy/testing/assertsql.py
test/dialect/postgresql/test_query.py