summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ansisql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-01-03 02:19:57 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-01-03 02:19:57 +0000
commitb6fc094c2c922f85555c2526b034ece5d0f32eef (patch)
tree36afe88df2ac56c006ae1a4ae2c640d6e887b9e3 /lib/sqlalchemy/ansisql.py
parent6f131f00c60e477942dbadec344bd1cf14c69ff2 (diff)
downloadsqlalchemy-b6fc094c2c922f85555c2526b034ece5d0f32eef.tar.gz
- order of constraint creation puts primary key first before all other constraints;
required for firebird, not a bad idea for others [ticket:408]
Diffstat (limited to 'lib/sqlalchemy/ansisql.py')
-rw-r--r--lib/sqlalchemy/ansisql.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/sqlalchemy/ansisql.py b/lib/sqlalchemy/ansisql.py
index 225188eb3..46131def2 100644
--- a/lib/sqlalchemy/ansisql.py
+++ b/lib/sqlalchemy/ansisql.py
@@ -701,8 +701,12 @@ class ANSISchemaGenerator(ANSISchemaBase):
first_pk = True
for constraint in column.constraints:
constraint.accept_schema_visitor(self, traverse=False)
-
- for constraint in table.constraints:
+
+ # On some DB order is significant: visit PK first, then the
+ # other constraints (engine.ReflectionTest.testbasic failed on FB2)
+ if len(table.primary_key):
+ table.primary_key.accept_schema_visitor(self, traverse=False)
+ for constraint in [c for c in table.constraints if c is not table.primary_key]:
constraint.accept_schema_visitor(self, traverse=False)
self.append("\n)%s\n\n" % self.post_create_table(table))