From 428dfeee48c1fc4ceb5712b8934e90132ee57e33 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 4 Jul 2016 16:37:26 -0400 Subject: Repair PG BIGSERIAL w/ TypeDecorator, Variant Some of the dialect impl memoization for TypeDecorator necessarily keeps the top-level TypeDecorator type around, since a user-defined type will have bind and result set processing behavior. For both TypeDecorator and Variant, PG dialect needs to ensure it's looking at the SQLAlchemy type to check for SmallInteger / BigInteger. Fixes: 3739 Change-Id: I2d45fb997f17c6272d6bb826a77d2dba665adae7 (cherry picked from commit 421fa6b8bf9f0c3c5041579c89ec405ce0f5e0b0) --- lib/sqlalchemy/dialects/postgresql/base.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/sqlalchemy/dialects') diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index 688ce9e1c..cc0f890dc 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -1484,6 +1484,9 @@ class PGDDLCompiler(compiler.DDLCompiler): colspec = self.preparer.format_column(column) impl_type = column.type.dialect_impl(self.dialect) + if isinstance(impl_type, sqltypes.TypeDecorator): + impl_type = impl_type.impl + if column.primary_key and \ column is column.table._autoincrement_column and \ ( -- cgit v1.2.1