From 867235e4902c91531095676e3a413d935181b0bd Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 20 Jan 2022 12:26:36 -0500 Subject: repair broken truediv test suite; memusage the truediv test suite didn't have __backend__ so wasn't running for every DB except in the main build. Repaired this as well as truediv support to preserve the right-hand side type when casting to numeric, if the right type is already a numeric type. also fixed a memusage test that relies on savepoints so was not running under gerrit runs. Change-Id: I3be223fdf697af9c1ed61b70d621f57cbbb7a92b --- lib/sqlalchemy/sql/compiler.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/sql') diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index af39f0672..8a3f26425 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -1932,7 +1932,13 @@ class SQLCompiler(Compiled): # TODO: would need a fast cast again here, # unless we want to use an implicit cast like "+ 0.0" + self.process( - elements.Cast(binary.right, sqltypes.Numeric()), **kw + elements.Cast( + binary.right, + binary.right.type + if binary.right.type._type_affinity is sqltypes.Numeric + else sqltypes.Numeric(), + ), + **kw, ) ) else: -- cgit v1.2.1