diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-05-31 16:47:19 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-05-31 16:48:01 -0400 |
| commit | e6572789bb6fec5f1ac07653908c0f29d7904ece (patch) | |
| tree | acf2955db1a6698f24b82c6c6c2ab1ba2848029d /lib/sqlalchemy | |
| parent | 90ed3cd99fe007626b2b830a93c8c1e14e15536a (diff) | |
| download | sqlalchemy-e6572789bb6fec5f1ac07653908c0f29d7904ece.tar.gz | |
Apply adaptation for most recent aliased=True first
Fixed regression in :meth:`.Query.join` where the ``aliased=True`` flag
would not properly apply clause adaptation to filter criteria, if a
previous join were made to the same entity. This is because the adapters
were placed in the wrong order. The order has been reversed so that the
adapter for the most recent ``aliased=True`` call takes precedence as was
the case in 1.2 and earlier. This broke the "elementtree" examples among
other things.
Fixes: #4704
Change-Id: I69f76c97b11157100854d552b5a0ce0103642ec4
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/orm/query.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py index 01a96d7b5..8f05a47b8 100644 --- a/lib/sqlalchemy/orm/query.py +++ b/lib/sqlalchemy/orm/query.py @@ -1769,7 +1769,6 @@ class Query(object): """ for criterion in list(criterion): criterion = coercions.expect(roles.WhereHavingRole, criterion) - criterion = self._adapt_clause(criterion, True, True) if self._criterion is not None: @@ -2800,7 +2799,8 @@ class Query(object): adapter = ORMAdapter( right, equivalents=right_mapper._equivalent_columns ) - self._filter_aliases += (adapter,) + # current adapter takes highest precedence + self._filter_aliases = (adapter,) + self._filter_aliases # if an alias() on the right side was generated, # which is intended to wrap a the right side in a subquery, |
