summaryrefslogtreecommitdiff
path: root/test/dialect/test_postgresql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-10-02 17:17:46 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2011-10-02 17:17:46 -0400
commitbf2f3595d07002d56c77b329387932d4d27e3c45 (patch)
tree06f68edb7131347e9cb2350bddbb5fd9f2a9cd5e /test/dialect/test_postgresql.py
parent4f1321c3e97f9bb1c92b378452a7810874927c71 (diff)
downloadsqlalchemy-bf2f3595d07002d56c77b329387932d4d27e3c45.tar.gz
- Added "postgresql_using" argument to Index(), produces
USING clause to specify index implementation for PG. [ticket:2290]. Thanks to Ryan P. Kelly for the patch.
Diffstat (limited to 'test/dialect/test_postgresql.py')
-rw-r--r--test/dialect/test_postgresql.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py
index adf292999..8f90becd5 100644
--- a/test/dialect/test_postgresql.py
+++ b/test/dialect/test_postgresql.py
@@ -174,6 +174,27 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
'(data text_pattern_ops, data2 int4_ops)',
dialect=postgresql.dialect())
+ def test_create_index_with_using(self):
+ m = MetaData()
+ tbl = Table('testtbl', m, Column('data', String))
+
+ idx1 = Index('test_idx1', tbl.c.data)
+ idx2 = Index('test_idx2', tbl.c.data, postgresql_using='btree')
+ idx3 = Index('test_idx3', tbl.c.data, postgresql_using='hash')
+
+ self.assert_compile(schema.CreateIndex(idx1),
+ 'CREATE INDEX test_idx1 ON testtbl '
+ '(data)',
+ dialect=postgresql.dialect())
+ self.assert_compile(schema.CreateIndex(idx2),
+ 'CREATE INDEX test_idx2 ON testtbl '
+ 'USING btree (data)',
+ dialect=postgresql.dialect())
+ self.assert_compile(schema.CreateIndex(idx3),
+ 'CREATE INDEX test_idx3 ON testtbl '
+ 'USING hash (data)',
+ dialect=postgresql.dialect())
+
@testing.uses_deprecated(r".*'postgres_where' argument has been "
"renamed.*")
def test_old_create_partial_index(self):