]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
ensure _ORMJoin transfers parententity from left side
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 27 Oct 2022 02:59:51 +0000 (22:59 -0400)
committermike bayer <mike_mp@zzzcomputing.com>
Fri, 28 Oct 2022 16:09:20 +0000 (16:09 +0000)
commit28541188aedb4074facc230a8d270be62c70bcce
treee27b441965000728ad5e608e5abe7305b4ca8aa4
parent2dc05f0c35f1b23168e65414d05ab275b0914f38
ensure _ORMJoin transfers parententity from left side

Fixed bug involving :class:`.Select` constructs which used a combination of
:meth:`.Select.select_from` with an ORM entity followed by
:meth:`.Select.join` against the entity sent in
:meth:`.Select.select_from`, as well as using plain
:meth:`.Select.join_from`, which when combined with a columns clause that
didn't explicitly include that entity would then cause "automatic WHERE
criteria" features such as the IN expression required for a single-table
inheritance subclass, as well as the criteria set up by the
:func:`_orm.with_loader_criteria` option, to not be rendered for that
entity. The correct entity is now transferred to the :class:`.Join` object
that's generated internally, so that the criteria against the left
side entity is correctly added.

Fixes: #8721
Change-Id: I8266430063e2c72071b7262fdd5ec5079fbcba3e
doc/build/changelog/unreleased_14/8721.rst [new file with mode: 0644]
lib/sqlalchemy/orm/_orm_constructors.py
lib/sqlalchemy/orm/context.py
lib/sqlalchemy/orm/util.py
test/orm/inheritance/test_single.py
test/orm/test_relationship_criteria.py