diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-04-01 11:36:16 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-04-01 13:47:42 -0400 |
| commit | 6d7d48af0dec6325f87ce497f769827107ad5035 (patch) | |
| tree | 9eaf19b69bde15881a826c86d0deb8f852d42b37 /lib/sqlalchemy/sql | |
| parent | b32a0fd286de3cd4cbfd248d74e200985d7e214a (diff) | |
| download | sqlalchemy-6d7d48af0dec6325f87ce497f769827107ad5035.tar.gz | |
Return self when Variant.coerce_compared_value would return impl
Fixed regression released in 1.1.5 due to :ticket:`3859` where
adjustments to the "right-hand-side" evaluation of an expression
based on :class:`.Variant` to honor the underlying type's
"right-hand-side" rules caused the :class:`.Variant` type
to be inappropriately lost, in those cases when we *do* want the
left-hand side type to be transferred directly to the right hand side
so that bind-level rules can be applied to the expression's argument.
Change-Id: Ia54dbbb19398549d654b74668753c4152599d900
Fixes: #3952
Diffstat (limited to 'lib/sqlalchemy/sql')
| -rw-r--r-- | lib/sqlalchemy/sql/type_api.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/type_api.py b/lib/sqlalchemy/sql/type_api.py index d537e49f0..4b561a705 100644 --- a/lib/sqlalchemy/sql/type_api.py +++ b/lib/sqlalchemy/sql/type_api.py @@ -1214,7 +1214,11 @@ class Variant(TypeDecorator): self.mapping = mapping def coerce_compared_value(self, operator, value): - return self.impl.coerce_compared_value(operator, value) + result = self.impl.coerce_compared_value(operator, value) + if result is self.impl: + return self + else: + return result def load_dialect_impl(self, dialect): if dialect.name in self.mapping: |
