]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Include UPDATE/DELETE extra_froms in correlation
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 4 Aug 2018 17:45:07 +0000 (13:45 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 4 Aug 2018 18:39:18 +0000 (14:39 -0400)
commit8d2d412d2afd4d3ce8a24876b86bdb56d1abc508
tree4d72e0ee4e82535ea31e00380bfa7ad495a6555a
parent108d331e8932833ae9f81c79ccc6a522717a75f4
Include UPDATE/DELETE extra_froms in correlation

Fixed bug where the multi-table support for UPDATE and DELETE statements
did not consider the additional FROM elements as targets for correlation,
when a correlated SELECT were also combined with the statement.  This
change now includes that a SELECT statement in the WHERE clause for such a
statement will try to auto-correlate back to these additional tables in the
parent UPDATE/DELETE or unconditionally correlate if
:meth:`.Select.correlate` is used.  Note that auto-correlation raises an
error if the SELECT statement would have no FROM clauses as a result, which
can now occur if the parent UPDATE/DELETE specifies the same tables in its
additional set of tables ; specify :meth:`.Select.correlate` explicitly to
resolve.

Change-Id: Ie11eaad7e49af3f59df11691b104d6359341bdae
Fixes: #4313
(cherry picked from commit abeea1d82db34232bbef01e98fa4d1de0f583eb6)
doc/build/changelog/unreleased_12/4313.rst [new file with mode: 0644]
lib/sqlalchemy/sql/compiler.py
test/sql/test_delete.py
test/sql/test_update.py