summaryrefslogtreecommitdiff
path: root/test/dialect/postgresql/test_compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-12-08 08:57:44 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2021-12-26 19:32:53 -0500
commit6d589ffbb5fe04a4ee606819e948974045f62b80 (patch)
tree95fc3ac54ae23945e3bf810f85294193f4fbbd82 /test/dialect/postgresql/test_compiler.py
parent2bb6cfc7c9b8f09eaa4efeffc337a1162993979c (diff)
downloadsqlalchemy-6d589ffbb5fe04a4ee606819e948974045f62b80.tar.gz
consider truediv as truediv; support floordiv operator
Implemented full support for "truediv" and "floordiv" using the "/" and "//" operators. A "truediv" operation between two expressions using :class:`_types.Integer` now considers the result to be :class:`_types.Numeric`, and the dialect-level compilation will cast the right operand to a numeric type on a dialect-specific basis to ensure truediv is achieved. For floordiv, conversion is also added for those databases that don't already do floordiv by default (MySQL, Oracle) and the ``FLOOR()`` function is rendered in this case, as well as for cases where the right operand is not an integer (needed for PostgreSQL, others). The change resolves issues both with inconsistent behavior of the division operator on different backends and also fixes an issue where integer division on Oracle would fail to be able to fetch a result due to inappropriate outputtypehandlers. Fixes: #4926 Change-Id: Id54cc018c1fb7a49dd3ce1216d68d40f43fe2659
Diffstat (limited to 'test/dialect/postgresql/test_compiler.py')
-rw-r--r--test/dialect/postgresql/test_compiler.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/dialect/postgresql/test_compiler.py b/test/dialect/postgresql/test_compiler.py
index 2bdc57386..0e04ccb95 100644
--- a/test/dialect/postgresql/test_compiler.py
+++ b/test/dialect/postgresql/test_compiler.py
@@ -779,7 +779,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
m = MetaData()
tbl = Table("testtbl", m, Column("x", Integer), Column("y", Integer))
- idx1 = Index("test_idx1", 5 / (tbl.c.x + tbl.c.y))
+ idx1 = Index("test_idx1", 5 // (tbl.c.x + tbl.c.y))
self.assert_compile(
schema.CreateIndex(idx1),
"CREATE INDEX test_idx1 ON testtbl ((5 / (x + y)))",