From ffe756d6242d513bfbba9686b5a3d90f0a67c214 Mon Sep 17 00:00:00 2001 From: Hannes Ljungberg Date: Wed, 13 Jan 2021 19:38:23 +0100 Subject: [PATCH] Refs #26167 -- Changed default value of DatabaseFeatures.supports_expression_indexes to True. --- django/db/backends/base/features.py | 2 +- django/db/backends/oracle/features.py | 1 - django/db/backends/postgresql/features.py | 1 - django/db/backends/sqlite3/features.py | 1 - docs/releases/3.2.txt | 6 ++++++ 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/django/db/backends/base/features.py b/django/db/backends/base/features.py index 7e22f879bab..4c892312950 100644 --- a/django/db/backends/base/features.py +++ b/django/db/backends/base/features.py @@ -282,7 +282,7 @@ class BaseDatabaseFeatures: # Does the backend support covering indexes (CREATE INDEX ... INCLUDE ...)? supports_covering_indexes = False # Does the backend support indexes on expressions? - supports_expression_indexes = False + supports_expression_indexes = True # Does the backend treat COLLATE as an indexed expression? collate_as_index_expression = False diff --git a/django/db/backends/oracle/features.py b/django/db/backends/oracle/features.py index bedc3985170..2570675809f 100644 --- a/django/db/backends/oracle/features.py +++ b/django/db/backends/oracle/features.py @@ -59,7 +59,6 @@ class DatabaseFeatures(BaseDatabaseFeatures): supports_ignore_conflicts = False max_query_params = 2**16 - 1 supports_partial_indexes = False - supports_expression_indexes = True supports_slicing_ordering_in_compound = True allows_multiple_constraints_on_same_fields = False supports_boolean_expr_in_select_clause = False diff --git a/django/db/backends/postgresql/features.py b/django/db/backends/postgresql/features.py index b7ec3777391..84259c0c19f 100644 --- a/django/db/backends/postgresql/features.py +++ b/django/db/backends/postgresql/features.py @@ -58,7 +58,6 @@ class DatabaseFeatures(BaseDatabaseFeatures): supports_deferrable_unique_constraints = True has_json_operators = True json_key_contains_list_matching_requires_list = True - supports_expression_indexes = True django_test_skips = { 'opclasses are PostgreSQL only.': { diff --git a/django/db/backends/sqlite3/features.py b/django/db/backends/sqlite3/features.py index 31055f8f993..3348256c747 100644 --- a/django/db/backends/sqlite3/features.py +++ b/django/db/backends/sqlite3/features.py @@ -38,7 +38,6 @@ class DatabaseFeatures(BaseDatabaseFeatures): 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) - supports_expression_indexes = True supports_over_clause = Database.sqlite_version_info >= (3, 25, 0) supports_frame_range_fixed_distance = Database.sqlite_version_info >= (3, 28, 0) supports_aggregate_filter_clause = Database.sqlite_version_info >= (3, 30, 1) diff --git a/docs/releases/3.2.txt b/docs/releases/3.2.txt index 2b0f0ee6ee4..3b1463be6f8 100644 --- a/docs/releases/3.2.txt +++ b/docs/releases/3.2.txt @@ -668,6 +668,12 @@ backends. backends must implement ``DatabaseClient.settings_to_cmd_args_env()`` or override ``DatabaseClient.runshell()``. +* Third-party database backends must implement support for functional indexes + (:attr:`.Index.expressions`) or set + ``DatabaseFeatures.supports_expression_indexes`` to ``False``. If ``COLLATE`` + is not a part of the ``CREATE INDEX`` statement, set + ``DatabaseFeatures.collate_as_index_expression`` to ``True``. + :mod:`django.contrib.admin` ---------------------------