From 693f7f7a84ac77eaacc9ff9c8035a249d7f1ce7e Mon Sep 17 00:00:00 2001 From: mike bayer Date: Wed, 15 Feb 2023 23:20:06 +0100 Subject: Fix coercion issue for tuple bindparams Fixed issue where element types of a tuple value would be hardcoded to take on the types from a compared-to tuple, when the comparison were using the :meth:`.ColumnOperators.in_` operator. This was inconsistent with the usual way that types are determined for a binary expression, which is that the actual element type on the right side is considered first before applying the left-hand-side type. Fixes: #9313 Change-Id: Ia8874c09682a6512fcf4084cf14481024959c461 --- test/sql/test_operators.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/sql/test_operators.py') diff --git a/test/sql/test_operators.py b/test/sql/test_operators.py index e7e51aa63..8ed8c7d33 100644 --- a/test/sql/test_operators.py +++ b/test/sql/test_operators.py @@ -4303,6 +4303,14 @@ class TupleTypingTest(fixtures.TestBase): expr = t1 == (3, "hi", b"there") self._assert_types(expr.right.type.types) + def test_tuple_type_left_type_ignored(self): + a, b = column("a", sqltypes.Date), column("b", sqltypes.DateTime) + c = column("c", sqltypes.Float) + + t1 = tuple_(a, b, c) + expr = t1.in_([(3, "hi", b"there")]) + self._assert_types(expr.right.type.types) + class InSelectableTest(fixtures.TestBase, testing.AssertsCompiledSQL): __dialect__ = "default" -- cgit v1.2.1