text = "CREATE "
if index.unique:
text += "UNIQUE "
- text += "INDEX %s ON %s " % (
+ text += "INDEX "
+
+ concurrently = index.dialect_options['postgresql']['concurrently']
+ if concurrently:
+ text += "CONCURRENTLY "
+
+ text += "%s ON %s " % (
self._prepared_index_name(index,
include_schema=False),
preparer.format_table(index.table)
(schema.Index, {
"using": False,
"where": None,
- "ops": {}
+ "ops": {},
+ "concurrently": False,
}),
(schema.Table, {
"ignore_search_path": False,
"CREATE INDEX test_idx1 ON testtbl ((data + 5))"
)
+ def test_create_index_concurrently(self):
+ m = MetaData()
+ tbl = Table('testtbl', m, Column('data', Integer))
+
+ idx1 = Index('test_idx1', tbl.c.data, postgresql_concurrently=True)
+ self.assert_compile(
+ schema.CreateIndex(idx1),
+ "CREATE INDEX CONCURRENTLY test_idx1 ON testtbl (data)"
+ )
+
def test_exclude_constraint_min(self):
m = MetaData()
tbl = Table('testtbl', m,