summaryrefslogtreecommitdiff
path: root/test/sql/test_constraints.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/sql/test_constraints.py')
-rw-r--r--test/sql/test_constraints.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/sql/test_constraints.py b/test/sql/test_constraints.py
index 462667bed..b1b731d66 100644
--- a/test/sql/test_constraints.py
+++ b/test/sql/test_constraints.py
@@ -765,6 +765,14 @@ class ConstraintCompilationTest(fixtures.TestBase, AssertsCompiledSQL):
i = Index("xyz", t.c.x)
self.assert_compile(schema.CreateIndex(i), "CREATE INDEX xyz ON t (x)")
+ def test_create_index_if_not_exists(self):
+ t = Table("t", MetaData(), Column("x", Integer))
+ i = Index("xyz", t.c.x)
+ self.assert_compile(
+ schema.CreateIndex(i, if_not_exists=True),
+ "CREATE INDEX IF NOT EXISTS xyz ON t (x)",
+ )
+
def test_drop_index_plain_unattached(self):
self.assert_compile(
schema.DropIndex(Index(name="xyz")), "DROP INDEX xyz"
@@ -775,6 +783,12 @@ class ConstraintCompilationTest(fixtures.TestBase, AssertsCompiledSQL):
schema.DropIndex(Index(name="xyz")), "DROP INDEX xyz"
)
+ def test_drop_index_if_exists(self):
+ self.assert_compile(
+ schema.DropIndex(Index(name="xyz"), if_exists=True),
+ "DROP INDEX IF EXISTS xyz",
+ )
+
def test_create_index_schema(self):
t = Table("t", MetaData(), Column("x", Integer), schema="foo")
i = Index("xyz", t.c.x)