Skip to content

Commit

Permalink
Refs #26167 -- SQLite3 supports expression indexes as of 3.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusH committed Jul 25, 2017
1 parent e2992c6 commit daf02f7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions django/db/backends/sqlite3/features.py
Expand Up @@ -40,6 +40,10 @@ def uses_savepoints(self):
def supports_index_column_ordering(self):
return Database.sqlite_version_info >= (3, 3, 0)

@cached_property
def supports_expression_indexes(self):
return Database.sqlite_version_info >= (3, 9, 0)

@cached_property
def can_release_savepoints(self):
return self.uses_savepoints
Expand Down
2 changes: 1 addition & 1 deletion django/db/models/indexes.py
Expand Up @@ -70,7 +70,7 @@ def get_sql_create_template_values(self, model, schema_editor, using):
'Not creating expression index:\n'
' {expression}\n'
'Expression indexes are not supported on {vendor}.'
).format(expression=column_expression, vendor=connection.vendor),
).format(expression=column_expression, vendor=connection.display_name),
)

expression = column_expression.resolve_expression(query)
Expand Down
5 changes: 5 additions & 0 deletions docs/ref/models/indexes.txt
Expand Up @@ -71,6 +71,11 @@ allows constructing indexes on mathematical operations.
:MySQL:
MySQL doesn't support expression indexes as of version 5.7.

:SQLite3:
"*The ability to index expressions was added to SQLite with version
3.9.0 (2015-10-14)*" --- `SQLite3 documentation
<https://sqlite.org/expridx.html#compatibility>`_.

:Oracle:
Oracle Database requires "*that any schema-level or package-level
PL/SQL function that the index expression invokes is deterministic
Expand Down

0 comments on commit daf02f7

Please sign in to comment.