diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-07-20 10:49:36 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-07-20 10:49:36 -0400 |
commit | b2d50f2807da38a4a0ecefc1a88ed4ab19e0e41c (patch) | |
tree | 462d41ff8e95edfa5526fcb206400377002178b1 /test/dialect/test_postgresql.py | |
parent | bd45f22e171c4bdde037e6a03b6102347d9b224b (diff) | |
download | sqlalchemy-b2d50f2807da38a4a0ecefc1a88ed4ab19e0e41c.tar.gz |
- Added new "postgresql_ops" argument to
Index, allows specification of PostgreSQL
operator classes for indexed columns.
[ticket:2198] Courtesy Filip Zyzniewski.
Diffstat (limited to 'test/dialect/test_postgresql.py')
-rw-r--r-- | test/dialect/test_postgresql.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py index 70730983c..4dffa0415 100644 --- a/test/dialect/test_postgresql.py +++ b/test/dialect/test_postgresql.py @@ -152,6 +152,28 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): "WHERE data > 'a' AND data < 'b''s'", dialect=postgresql.dialect()) + def test_create_index_with_ops(self): + m = MetaData() + tbl = Table('testtbl', m, + Column('data', String), + Column('data2', key='d2', Integer)) + + idx = Index('test_idx1', tbl.c.data, + postgresql_ops={'data': 'text_pattern_ops'}) + + idx2 = Index('test_idx2', tbl.c.data, tbl.c.d2, + postgresql_ops={'data': 'text_pattern_ops', + 'd2': 'int4_ops'}) + + self.assert_compile(schema.CreateIndex(idx), + 'CREATE INDEX test_idx1 ON testtbl ' + '(data text_pattern_ops)', + dialect=postgresql.dialect()) + self.assert_compile(schema.CreateIndex(idx2), + 'CREATE INDEX test_idx2 ON testtbl ' + '(data text_pattern_ops, data2 int4_ops)', + dialect=postgresql.dialect()) + @testing.uses_deprecated(r".*'postgres_where' argument has been " "renamed.*") def test_old_create_partial_index(self): |