]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Fixed errant space character when generating ADD CONSTRAINT
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 26 Apr 2010 04:11:22 +0000 (00:11 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 26 Apr 2010 04:11:22 +0000 (00:11 -0400)
for a named UNIQUE constraint.

CHANGES
lib/sqlalchemy/sql/compiler.py
test/sql/test_constraints.py

diff --git a/CHANGES b/CHANGES
index 01283843f41a47f04fd2771a1d63bde96fd1c25f..d7e7b3dfc3b1b606c4060032ed92356b3ef8c8e1 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -9,6 +9,9 @@ CHANGES
   - Fixed bug that prevented implicit RETURNING from functioning
     properly with composite primary key that contained zeroes.
     [ticket:1778]
+  
+  - Fixed errant space character when generating ADD CONSTRAINT
+    for a named UNIQUE constraint.
     
 - oracle
   - Added a check for cx_oracle versions lower than version 5,
index 7a1821a70dd0162c4e1cc597ed595052fc2c32c0..0e5f3499ec1e276752f6c63a2b0f93bd1c93a8cd 100644 (file)
@@ -1299,7 +1299,7 @@ class DDLCompiler(engine.Compiled):
     def visit_unique_constraint(self, constraint):
         text = ""
         if constraint.name is not None:
-            text += "CONSTRAINT %s " % self.preparer.format_constraint(constraint)
+            text += "CONSTRAINT %s" % self.preparer.format_constraint(constraint)
         text += " UNIQUE (%s)" % (', '.join(self.preparer.quote(c.name, c.quote) for c in constraint))
         text += self.define_constraint_deferrability(constraint)
         return text
index 97f5190d4ce6c5c6a4e8c0bb7ebd5c919a25d825..eed77ed83932a5de8b8908a13fee55afaec32a9d 100644 (file)
@@ -376,13 +376,13 @@ class ConstraintCompilationTest(TestBase, AssertsCompiledSQL):
         t2.append_constraint(constraint)
         self.assert_compile(
             schema.AddConstraint(constraint),
-            "ALTER TABLE t2 ADD CONSTRAINT uq_cst  UNIQUE (a, b)"
+            "ALTER TABLE t2 ADD CONSTRAINT uq_cst UNIQUE (a, b)"
         )
         
         constraint = UniqueConstraint(t2.c.a, t2.c.b, name="uq_cs2")
         self.assert_compile(
             schema.AddConstraint(constraint),
-            "ALTER TABLE t2 ADD CONSTRAINT uq_cs2  UNIQUE (a, b)"
+            "ALTER TABLE t2 ADD CONSTRAINT uq_cs2 UNIQUE (a, b)"
         )
         
         assert t.c.a.primary_key is False