]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
adding an "already exists" catch for CREATE DOMAIN
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 18 Aug 2007 21:43:53 +0000 (21:43 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 18 Aug 2007 21:43:53 +0000 (21:43 +0000)
test/dialect/postgres.py

index f80ddcadd66280bf69ef600d67fc7b8f82a98327..221f7660a9f990861f8bccbbea3513c2fb25f9ad 100644 (file)
@@ -11,8 +11,12 @@ class DomainReflectionTest(AssertMixin):
     @testing.supported('postgres')
     def setUpAll(self):
         con = testbase.db.connect()
-        con.execute('CREATE DOMAIN testdomain INTEGER NOT NULL DEFAULT 42')
-        con.execute('CREATE DOMAIN alt_schema.testdomain INTEGER DEFAULT 0')
+        try:
+            con.execute('CREATE DOMAIN testdomain INTEGER NOT NULL DEFAULT 42')
+            con.execute('CREATE DOMAIN alt_schema.testdomain INTEGER DEFAULT 0')
+        except exceptions.SQLError, e:
+            if not "already exists" in str(e):
+                raise e
         con.execute('CREATE TABLE testtable (question integer, answer testdomain)')
         con.execute('CREATE TABLE alt_schema.testtable(question integer, answer alt_schema.testdomain, anything integer)')
         con.execute('CREATE TABLE crosschema (question integer, answer alt_schema.testdomain)')