]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Fold entities into existing joins when resolving FROM ambiguity
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 3 Apr 2019 02:12:09 +0000 (22:12 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 3 Apr 2019 03:42:36 +0000 (23:42 -0400)
commit25a42e93f4ef5ce1a9f9c23fbcdea3e21a7b3f1a
treeeeac2f3da63270443bffbb59d8001a1a309b3344
parentfd2ecb5f87c1c0132263b5a35067c4bb76160fb2
Fold entities into existing joins when resolving FROM ambiguity

Fixed 1.3 regression in new "ambiguous FROMs" query logic introduced in
:ref:`change_4365` where a :class:`.Query` that explicitly places an entity
in the FROM clause with :meth:`.Query.select_from` and also joins to it
using :meth:`.Query.join` would later cause an "ambiguous FROM" error if
that entity were used in additional joins, as the entity appears twice in
the "from" list of the :class:`.Query`.  The fix resolves this ambiguity by
folding the standalone entity into the join that it's already a part of in
the same way that ultimately happens when the SELECT statement is rendered.

Fixes: #4584
Change-Id: Ic62ca09c6d329695b21ed4f1be8621edcbb18e19
doc/build/changelog/unreleased_13/4584.rst [new file with mode: 0644]
lib/sqlalchemy/sql/util.py
test/orm/test_joins.py