summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases/postgres.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-06-26 20:01:56 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-06-26 20:01:56 +0000
commit8438ad748253e737bdf839bb5cebd58cdf941025 (patch)
tree7d5fc6adc1a2c6c116dca1398e621ecb5b2d05f6 /lib/sqlalchemy/databases/postgres.py
parent49090a7a9434245b03a7f867add2401d3a78fead (diff)
downloadsqlalchemy-8438ad748253e737bdf839bb5cebd58cdf941025.tar.gz
dont put SERIAL on a column if it has a ForeignKey
Diffstat (limited to 'lib/sqlalchemy/databases/postgres.py')
-rw-r--r--lib/sqlalchemy/databases/postgres.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py
index 50d67ad56..de21bd570 100644
--- a/lib/sqlalchemy/databases/postgres.py
+++ b/lib/sqlalchemy/databases/postgres.py
@@ -331,7 +331,7 @@ class PGSchemaGenerator(ansisql.ANSISchemaGenerator):
def get_column_specification(self, column, override_pk=False, **kwargs):
colspec = column.name
- if column.primary_key and isinstance(column.type, sqltypes.Integer) 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 isinstance(column.type, sqltypes.Integer) 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()