summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-01-20 12:26:36 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2022-01-20 13:25:11 -0500
commit867235e4902c91531095676e3a413d935181b0bd (patch)
tree921c46b34c1c95f9f2e6ca1b5c75bc8f06e2888b /lib/sqlalchemy/sql/compiler.py
parentc6b15e443e0cfc7a09eb24c37123a595fdb639ca (diff)
downloadsqlalchemy-867235e4902c91531095676e3a413d935181b0bd.tar.gz
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
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r--lib/sqlalchemy/sql/compiler.py8
1 files changed, 7 insertions, 1 deletions
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: