From: Mike Bayer Date: Fri, 18 Feb 2011 02:05:24 +0000 (-0500) Subject: -adjust the fix for [ticket:2065] to not rely upon type affinity, revert X-Git-Tag: rel_0_7b2~1^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d8117b3aa29d28c84f09770906fbd930927e8e2a;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git -adjust the fix for [ticket:2065] to not rely upon type affinity, revert the _type_affinity attribute of SmallInteger, BigInteger --- diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index 8bc95ef482..b6a6357b5f 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -505,10 +505,10 @@ class PGCompiler(compiler.SQLCompiler): class PGDDLCompiler(compiler.DDLCompiler): def get_column_specification(self, column, **kwargs): colspec = self.preparer.format_column(column) - type_affinity = column.type._type_affinity + impl_type = column.type.dialect_impl(self.dialect) if column.primary_key and \ column is column.table._autoincrement_column and \ - not issubclass(type_affinity, sqltypes.SmallInteger) and \ + not isinstance(impl_type, sqltypes.SmallInteger) and \ ( column.default is None or ( @@ -516,7 +516,7 @@ class PGDDLCompiler(compiler.DDLCompiler): column.default.optional ) ): - if issubclass(type_affinity, sqltypes.BigInteger): + if isinstance(impl_type, sqltypes.BigInteger): colspec += " BIGSERIAL" else: colspec += " SERIAL" diff --git a/lib/sqlalchemy/types.py b/lib/sqlalchemy/types.py index 71b55f33f9..d25fa3070b 100644 --- a/lib/sqlalchemy/types.py +++ b/lib/sqlalchemy/types.py @@ -1007,9 +1007,6 @@ class SmallInteger(Integer): __visit_name__ = 'small_integer' - @property - def _type_affinity(self): - return SmallInteger class BigInteger(Integer): """A type for bigger ``int`` integers. @@ -1021,9 +1018,6 @@ class BigInteger(Integer): __visit_name__ = 'big_integer' - @property - def _type_affinity(self): - return BigInteger class Numeric(_DateAffinity, TypeEngine): """A type for fixed precision numbers.