diff --git a/django/db/backends/base/features.py b/django/db/backends/base/features.py index 7a71c76bd3..980d7e4d21 100644 --- a/django/db/backends/base/features.py +++ b/django/db/backends/base/features.py @@ -275,6 +275,7 @@ class BaseDatabaseFeatures: # Does the backend support partial indexes (CREATE INDEX ... WHERE ...)? supports_partial_indexes = True + supports_functions_in_partial_indexes = True def __init__(self, connection): self.connection = connection diff --git a/django/db/backends/sqlite3/features.py b/django/db/backends/sqlite3/features.py index c57b8e1934..69a42cdc02 100644 --- a/django/db/backends/sqlite3/features.py +++ b/django/db/backends/sqlite3/features.py @@ -39,3 +39,4 @@ class DatabaseFeatures(BaseDatabaseFeatures): # reasonably performant way. supports_pragma_foreign_key_check = Database.sqlite_version_info >= (3, 20, 0) can_defer_constraint_checks = supports_pragma_foreign_key_check + supports_functions_in_partial_indexes = Database.sqlite_version_info >= (3, 15, 0) diff --git a/tests/indexes/tests.py b/tests/indexes/tests.py index ef81f6ab9b..7eb5dd89a9 100644 --- a/tests/indexes/tests.py +++ b/tests/indexes/tests.py @@ -303,6 +303,7 @@ class PartialIndexTests(TransactionTestCase): )) editor.remove_index(index=index, model=Article) + @skipUnlessDBFeature('supports_functions_in_partial_indexes') def test_multiple_conditions(self): with connection.schema_editor() as editor: index = Index(