diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-01-03 02:19:57 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-01-03 02:19:57 +0000 |
| commit | b6fc094c2c922f85555c2526b034ece5d0f32eef (patch) | |
| tree | 36afe88df2ac56c006ae1a4ae2c640d6e887b9e3 | |
| parent | 6f131f00c60e477942dbadec344bd1cf14c69ff2 (diff) | |
| download | sqlalchemy-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]
| -rw-r--r-- | CHANGES | 2 | ||||
| -rw-r--r-- | lib/sqlalchemy/ansisql.py | 8 |
2 files changed, 8 insertions, 2 deletions
@@ -15,6 +15,8 @@ non-ambiguous. - invalid options sent to 'cascade' string will raise an exception [ticket:406] - fixed bug in mapper refresh/expire whereby eager loaders didnt properly re-populate item lists [ticket:407] +- order of constraint creation puts primary key first before all other constraints; +required for firebird, not a bad idea for others [ticket:408] 0.3.3 - string-based FROM clauses fixed, i.e. select(..., from_obj=["sometext"]) 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)) |
