diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-09-23 17:21:56 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-09-23 17:21:56 +0000 |
| commit | 372a8d76a61649e7952ec9a465c731aa00352363 (patch) | |
| tree | 0f5411fca45c46f671fea327fbcc897a6c0030ac /lib/sqlalchemy/databases/postgres.py | |
| parent | 9047fab83bd1bd21bed2f1857cb35679c75712f3 (diff) | |
| download | sqlalchemy-372a8d76a61649e7952ec9a465c731aa00352363.tar.gz | |
- added autoincrement=True to Column; will disable schema generation
of SERIAL/AUTO_INCREMENT/identity seq for postgres/mysql/mssql if
explicitly set to False. #303
Diffstat (limited to 'lib/sqlalchemy/databases/postgres.py')
| -rw-r--r-- | lib/sqlalchemy/databases/postgres.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py index 7bf786976..6fe51ad9a 100644 --- a/lib/sqlalchemy/databases/postgres.py +++ b/lib/sqlalchemy/databases/postgres.py @@ -490,7 +490,7 @@ class PGSchemaGenerator(ansisql.ANSISchemaGenerator): def get_column_specification(self, column, **kwargs): colspec = self.preparer.format_column(column) - if column.primary_key and not column.foreign_key and isinstance(column.type, sqltypes.Integer) and not isinstance(column.type, sqltypes.SmallInteger) and (column.default is None or (isinstance(column.default, schema.Sequence) and column.default.optional)): + if column.primary_key and not column.foreign_key and column.autoincrement and isinstance(column.type, sqltypes.Integer) and not isinstance(column.type, sqltypes.SmallInteger) and (column.default is None or (isinstance(column.default, schema.Sequence) and column.default.optional)): colspec += " SERIAL" else: colspec += " " + column.type.engine_impl(self.engine).get_col_spec() @@ -520,7 +520,7 @@ class PGDefaultRunner(ansisql.ANSIDefaultRunner): if isinstance(column.default, schema.PassiveDefault): c = self.proxy("select %s" % column.default.arg) return c.fetchone()[0] - elif isinstance(column.type, sqltypes.Integer) and (column.default is None or (isinstance(column.default, schema.Sequence) and column.default.optional)): + elif (isinstance(column.type, sqltypes.Integer) and column.autoincrement) and (column.default is None or (isinstance(column.default, schema.Sequence) and column.default.optional)): sch = column.table.schema # TODO: this has to build into the Sequence object so we can get the quoting # logic from it |
