diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-01-12 15:49:59 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-01-12 15:49:59 -0500 |
commit | 0f31f36fe59aa2053271df459fbc3092a0ce599c (patch) | |
tree | c34d109f59e7221f1afe88a2b009a4f44abd2f31 /lib/sqlalchemy/schema.py | |
parent | c9ebe3b723ecc17bb171343f05534f4fd7c9a9fc (diff) | |
download | sqlalchemy-0f31f36fe59aa2053271df459fbc3092a0ce599c.tar.gz |
- dont count server_default absense as part of autoincrement, PG
will have a value here upon reflection.
- mysql, others will have to check "server_default" when rendering
special keywords like AUTOINCREMENT
Diffstat (limited to 'lib/sqlalchemy/schema.py')
-rw-r--r-- | lib/sqlalchemy/schema.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py index a81874500..a530a1a7a 100644 --- a/lib/sqlalchemy/schema.py +++ b/lib/sqlalchemy/schema.py @@ -325,9 +325,11 @@ class Table(SchemaItem, expression.TableClause): if col.autoincrement and \ issubclass(col.type._type_affinity, types.Integer) and \ not col.foreign_keys and \ - isinstance(col.default, (type(None), Sequence)) and \ - col.server_default is None: - + isinstance(col.default, (type(None), Sequence)): + # don't look at server_default here since different backends may + # or may not have a server_default, e.g. postgresql reflected + # SERIAL cols will have a DefaultClause here but are still + # autoincrement. return col @property |