From: Mike Bayer Date: Thu, 14 Apr 2011 17:54:47 +0000 (-0400) Subject: - Fixed support for precision numerics when using X-Git-Tag: rel_0_7b4~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9113b5dbfe5fec59759b1018465e729f6741167;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - Fixed support for precision numerics when using pg8000. [ticket:2132] --- diff --git a/CHANGES b/CHANGES index b1810f8742..5d4d7cd871 100644 --- a/CHANGES +++ b/CHANGES @@ -139,6 +139,9 @@ CHANGES - postgresql - Psycopg2 for Python 3 is now supported. + - Fixed support for precision numerics when using + pg8000. [ticket:2132] + - oracle - Using column names that would require quotes for the column itself or for a name-generated diff --git a/lib/sqlalchemy/dialects/postgresql/pg8000.py b/lib/sqlalchemy/dialects/postgresql/pg8000.py index 44e095cdd9..ac927edbb6 100644 --- a/lib/sqlalchemy/dialects/postgresql/pg8000.py +++ b/lib/sqlalchemy/dialects/postgresql/pg8000.py @@ -56,6 +56,11 @@ class _PGNumeric(sqltypes.Numeric): raise exc.InvalidRequestError( "Unknown PG numeric type: %d" % coltype) + +class _PGNumericNoBind(_PGNumeric): + def bind_processor(self, dialect): + return None + class PGExecutionContext_pg8000(PGExecutionContext): pass @@ -94,7 +99,8 @@ class PGDialect_pg8000(PGDialect): colspecs = util.update_copy( PGDialect.colspecs, { - sqltypes.Numeric : _PGNumeric, + sqltypes.Numeric : _PGNumericNoBind, + sqltypes.Float : _PGNumeric } ) diff --git a/test/sql/test_types.py b/test/sql/test_types.py index d44487d536..8a8ae9cae5 100644 --- a/test/sql/test_types.py +++ b/test/sql/test_types.py @@ -1435,7 +1435,6 @@ class NumericTest(fixtures.TestBase): ) @testing.fails_on('sqlite', 'TODO') - @testing.fails_on('postgresql+pg8000', 'TODO') @testing.fails_on("firebird", "Precision must be from 1 to 18") @testing.fails_on("sybase+pysybase", "TODO") @testing.fails_on('mssql+pymssql', 'FIXME: improve pymssql dec handling')