From aa2128427064a2bdeaeff5dc946ecbb3727c90aa Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 3 Oct 2018 10:40:38 -0400 Subject: Support tuples of heterogeneous types for empty expanding IN Pass a list of all the types for the left side of an IN expression to the visit_empty_set_expr() method, so that the "empty expanding IN" can produce clauses for each element. Fixes: #4271 Change-Id: I2738b9df2292ac01afda37f16d4fa56ae7bf9147 --- lib/sqlalchemy/sql/default_comparator.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/sql/default_comparator.py') diff --git a/lib/sqlalchemy/sql/default_comparator.py b/lib/sqlalchemy/sql/default_comparator.py index 5d02f65a1..8149f9731 100644 --- a/lib/sqlalchemy/sql/default_comparator.py +++ b/lib/sqlalchemy/sql/default_comparator.py @@ -15,7 +15,8 @@ from .elements import BindParameter, True_, False_, BinaryExpression, \ Null, _const_expr, _clause_element_as_expr, \ ClauseList, ColumnElement, TextClause, UnaryExpression, \ collate, _is_literal, _literal_as_text, ClauseElement, and_, or_, \ - Slice, Visitable, _literal_as_binds, CollectionAggregate + Slice, Visitable, _literal_as_binds, CollectionAggregate, \ + Tuple from .selectable import SelectBase, Alias, Selectable, ScalarSelect @@ -145,6 +146,14 @@ def _in_impl(expr, op, seq_or_selectable, negate_op, **kw): elif isinstance(seq_or_selectable, ClauseElement): if isinstance(seq_or_selectable, BindParameter) and \ seq_or_selectable.expanding: + + if isinstance(expr, Tuple): + seq_or_selectable = ( + seq_or_selectable._with_expanding_in_types( + [elem.type for elem in expr] + ) + ) + return _boolean_compare( expr, op, seq_or_selectable, -- cgit v1.2.1