summaryrefslogtreecommitdiff
path: root/test/dialect/postgresql
diff options
context:
space:
mode:
authorIuri de Silvio <iurisilvio@gmail.com>2016-04-27 10:27:00 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2016-06-08 14:41:05 -0400
commit31a0da32a8af2503c6b94123a0e869816d83c707 (patch)
treef4ee475d51518e3216ede8df3ad4bf1e5ba18c33 /test/dialect/postgresql
parent24d29a63b6a30d1f1cd4d1097c021be0302c7922 (diff)
downloadsqlalchemy-31a0da32a8af2503c6b94123a0e869816d83c707.tar.gz
Support `postgresql_concurrently` on index dropping.
Also adds version detection so that DROP INDEX CONCURRENTLY only renders if the Postgresql version is 9.2 or higher; for CREATE INDEX CONCURRENTLY, version detection is added to allow the phrase to omit if the Postgresql version is less than 8.2. Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Change-Id: I597287e0ebbbe256c957a3579b58ace6848ab4f4 Pull-request: https://bitbucket.org/zzzeek/sqlalchemy/pull-requests/84
Diffstat (limited to 'test/dialect/postgresql')
-rw-r--r--test/dialect/postgresql/test_compiler.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/dialect/postgresql/test_compiler.py b/test/dialect/postgresql/test_compiler.py
index c8dc9582a..f85ff2682 100644
--- a/test/dialect/postgresql/test_compiler.py
+++ b/test/dialect/postgresql/test_compiler.py
@@ -485,6 +485,32 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
"CREATE INDEX CONCURRENTLY test_idx1 ON testtbl (data)"
)
+ dialect_8_1 = postgresql.dialect()
+ dialect_8_1._supports_create_index_concurrently = False
+ self.assert_compile(
+ schema.CreateIndex(idx1),
+ "CREATE INDEX test_idx1 ON testtbl (data)",
+ dialect=dialect_8_1
+ )
+
+ def test_drop_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.DropIndex(idx1),
+ "DROP INDEX CONCURRENTLY test_idx1"
+ )
+
+ dialect_9_1 = postgresql.dialect()
+ dialect_9_1._supports_drop_index_concurrently = False
+ self.assert_compile(
+ schema.DropIndex(idx1),
+ "DROP INDEX test_idx1",
+ dialect=dialect_9_1
+ )
+
def test_exclude_constraint_min(self):
m = MetaData()
tbl = Table('testtbl', m,