From ff821e57c960f095ab2988a0f892b3127374f498 Mon Sep 17 00:00:00 2001 From: Federico Caselli Date: Wed, 26 Apr 2023 21:40:38 +0200 Subject: Ensure float are not implemented as numeric Fixed the base class for dialect-specific float/double types; Oracle :class:`_oracle.BINARY_DOUBLE` now subclasses :class:`_sqltypes.Double`, and internal types for :class:`_sqltypes.Float` for asyncpg and pg8000 now correctly subclass :class:`_sqltypes.Float`. Added suite tests to ensure that floating point types, such as class:`_types.Float` and :class:`_types.Double` are not resolved as class:`_types.Numeric` in the dialect, since it may not compatible in all cases, such as when casting a value. Change-Id: I20b814e8e029d57921d9728a55f2570f74c35c87 --- lib/sqlalchemy/dialects/postgresql/asyncpg.py | 2 +- lib/sqlalchemy/dialects/postgresql/pg8000.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy/dialects/postgresql') diff --git a/lib/sqlalchemy/dialects/postgresql/asyncpg.py b/lib/sqlalchemy/dialects/postgresql/asyncpg.py index c879205e4..a25502b90 100644 --- a/lib/sqlalchemy/dialects/postgresql/asyncpg.py +++ b/lib/sqlalchemy/dialects/postgresql/asyncpg.py @@ -322,7 +322,7 @@ class AsyncpgNumeric(sqltypes.Numeric): ) -class AsyncpgFloat(AsyncpgNumeric): +class AsyncpgFloat(AsyncpgNumeric, sqltypes.Float): __visit_name__ = "float" render_bind_cast = True diff --git a/lib/sqlalchemy/dialects/postgresql/pg8000.py b/lib/sqlalchemy/dialects/postgresql/pg8000.py index 3f01b00e8..a32d375c7 100644 --- a/lib/sqlalchemy/dialects/postgresql/pg8000.py +++ b/lib/sqlalchemy/dialects/postgresql/pg8000.py @@ -148,7 +148,7 @@ class _PGNumeric(sqltypes.Numeric): ) -class _PGFloat(_PGNumeric): +class _PGFloat(_PGNumeric, sqltypes.Float): __visit_name__ = "float" render_bind_cast = True -- cgit v1.2.1