From 5c60aaefd32a7bdee611fb340911409e0b8223ed Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 1 Jul 2016 12:44:47 -0400 Subject: Preserve type for math negation Fixed issue in SQL math negation operator where the type of the expression would no longer be the numeric type of the original. This would cause issues where the type determined result set behaviors. Change-Id: If0e339614a3686e251235fc94b6f59310c4630a5 Fixes: #3735 --- lib/sqlalchemy/sql/default_comparator.py | 2 +- 1 file changed, 1 insertion(+), 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 7630a9821..827492f10 100644 --- a/lib/sqlalchemy/sql/default_comparator.py +++ b/lib/sqlalchemy/sql/default_comparator.py @@ -192,7 +192,7 @@ def _inv_impl(expr, op, **kw): def _neg_impl(expr, op, **kw): """See :meth:`.ColumnOperators.__neg__`.""" - return UnaryExpression(expr, operator=operators.neg) + return UnaryExpression(expr, operator=operators.neg, type_=expr.type) def _match_impl(expr, op, other, **kw): -- cgit v1.2.1