]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
translate joined inheritance cols in UPDATE/DELETE
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 3 Aug 2022 20:55:23 +0000 (16:55 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 5 Aug 2022 16:53:35 +0000 (12:53 -0400)
commit9f992e42189746a7aff497abcf6ea9c08ab79e97
treee2929beb07c29813c16bac05060a89e112166ab9
parent0027b3a4bc54599ac8102a4a3d81d8007738903e
translate joined inheritance cols in UPDATE/DELETE

Fixed issue in ORM enabled UPDATE when the statement is created against a
joined-inheritance subclass, updating only local table columns, where the
"fetch" synchronization strategy would not render the correct RETURNING
clause for databases that use RETURNING for fetch synchronization.
Also adjusts the strategy used for RETURNING in UPDATE FROM and
DELETE FROM statements.

Also fixes MariaDB which does not support RETURNING with
DELETE..USING.  this was not caught in tests because
"fetch" strategy wasn't tested.  so also adjust the ORMDMLState
classes to look for "extra froms" first before adding
RETURNING, add new parameters to interfaces for
"update_returning_multitable" and "delete_returning_multitable".
A new execution option is_delete_using=True, described in the
changelog message, is added to allow the ORM to know up front
if a certain statement should have a SELECT up front
for "fetch" strategy.

Fixes: #8344
Change-Id: I3dcdb68e6e97ab0807a573c2fdb3d53c16d063ba
12 files changed:
doc/build/changelog/unreleased_20/6195_7011.rst [new file with mode: 0644]
doc/build/changelog/unreleased_20/8344.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/dialects/postgresql/base.py
lib/sqlalchemy/engine/default.py
lib/sqlalchemy/engine/interfaces.py
lib/sqlalchemy/orm/persistence.py
lib/sqlalchemy/orm/query.py
lib/sqlalchemy/sql/dml.py
test/orm/test_update_delete.py
test/requirements.py
test/sql/test_delete.py