From 69502725db4829a84872697fd6569631d2a3c47f Mon Sep 17 00:00:00 2001 From: RamonWill Date: Thu, 20 Aug 2020 15:05:39 -0400 Subject: Reflect mssql/postgresql filtered/partial indexes Added support for inspection / reflection of partial indexes / filtered indexes, i.e. those which use the ``mssql_where`` or ``postgresql_where`` parameters, with :class:`_schema.Index`. The entry is both part of the dictionary returned by :meth:`.Inspector.get_indexes` as well as part of a reflected :class:`_schema.Index` construct that was reflected. Pull request courtesy Ramon Williams. **Have a nice day!** Fixes: #4966 Closes: #5504 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5504 Pull-request-sha: b3018bac987081193b2e65cfdb6aeb7d5d270fcd Change-Id: Icbb2f93d1545700718ccb5222097185b815f5dbc --- test/dialect/postgresql/test_compiler.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/dialect/postgresql/test_compiler.py') diff --git a/test/dialect/postgresql/test_compiler.py b/test/dialect/postgresql/test_compiler.py index 708dbe147..517d570c9 100644 --- a/test/dialect/postgresql/test_compiler.py +++ b/test/dialect/postgresql/test_compiler.py @@ -452,7 +452,20 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): dialect=postgresql.dialect(), ) + idx3 = Index( + "test_idx2", + tbl.c.data, + postgresql_where="data > 'a' AND data < 'b''s'", + ) + self.assert_compile( + schema.CreateIndex(idx3), + "CREATE INDEX test_idx2 ON testtbl (data) " + "WHERE data > 'a' AND data < 'b''s'", + dialect=postgresql.dialect(), + ) + def test_create_index_with_ops(self): + m = MetaData() tbl = Table( "testtbl", -- cgit v1.2.1