From 27193aea0088b238e3ee0f0f235364a34a09265c Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Tue, 3 Oct 2017 10:42:18 -0400 Subject: [PATCH] Fixed #28584 -- Dropped support for SQLite < 3.7.15. --- django/db/backends/sqlite3/features.py | 12 +++--------- django/db/backends/sqlite3/introspection.py | 15 --------------- docs/ref/contrib/gis/install/index.txt | 2 +- docs/ref/models/indexes.txt | 6 ------ docs/topics/db/transactions.txt | 10 +++++----- docs/topics/testing/overview.txt | 2 +- tests/expressions_case/tests.py | 8 +------- 7 files changed, 11 insertions(+), 44 deletions(-) diff --git a/django/db/backends/sqlite3/features.py b/django/db/backends/sqlite3/features.py index fcebec063e4e0..df773be3ca128 100644 --- a/django/db/backends/sqlite3/features.py +++ b/django/db/backends/sqlite3/features.py @@ -2,8 +2,6 @@ from django.db.backends.base.features import BaseDatabaseFeatures from django.utils.functional import cached_property -from .base import Database - class DatabaseFeatures(BaseDatabaseFeatures): # SQLite cannot handle us only partially reading from a cursor's result set @@ -30,13 +28,9 @@ class DatabaseFeatures(BaseDatabaseFeatures): supports_temporal_subtraction = True ignores_table_name_case = True supports_cast_with_precision = False - uses_savepoints = Database.sqlite_version_info >= (3, 6, 8) - supports_index_column_ordering = Database.sqlite_version_info >= (3, 3, 0) - can_release_savepoints = uses_savepoints - can_share_in_memory_db = ( - Database.__name__ == 'sqlite3.dbapi2' and - Database.sqlite_version_info >= (3, 7, 13) - ) + uses_savepoints = True + can_release_savepoints = True + can_share_in_memory_db = True @cached_property def supports_stddev(self): diff --git a/django/db/backends/sqlite3/introspection.py b/django/db/backends/sqlite3/introspection.py index 0326082996479..5a4a21495fc30 100644 --- a/django/db/backends/sqlite3/introspection.py +++ b/django/db/backends/sqlite3/introspection.py @@ -87,21 +87,6 @@ def get_sequences(self, cursor, table_name, table_fields=()): pk_col = self.get_primary_key_column(cursor, table_name) return [{'table': table_name, 'column': pk_col}] - def column_name_converter(self, name): - """ - SQLite will in some cases, e.g. when returning columns from views and - subselects, return column names in 'alias."column"' format instead of - simply 'column'. - - Affects SQLite < 3.7.15, fixed by http://www.sqlite.org/src/info/5526e0aa3c - """ - # TODO: remove when SQLite < 3.7.15 is sufficiently old. - # 3.7.13 ships in Debian stable as of 2014-03-21. - if self.connection.Database.sqlite_version_info < (3, 7, 15): - return name.split('.')[-1].strip('"') - else: - return name - def get_relations(self, cursor, table_name): """ Return a dictionary of {field_name: (field_name_other_table, other_table)} diff --git a/docs/ref/contrib/gis/install/index.txt b/docs/ref/contrib/gis/install/index.txt index 78d3cd6723ebf..2d647593e3a14 100644 --- a/docs/ref/contrib/gis/install/index.txt +++ b/docs/ref/contrib/gis/install/index.txt @@ -61,7 +61,7 @@ Database Library Requirements Supported Versions Notes PostgreSQL GEOS, GDAL, PROJ.4, PostGIS 9.4+ Requires PostGIS. MySQL GEOS, GDAL 5.6+ Not OGC-compliant; :ref:`limited functionality `. Oracle GEOS, GDAL 12.1+ XE not supported. -SQLite GEOS, GDAL, PROJ.4, SpatiaLite 3.6.+ Requires SpatiaLite 4.1+ +SQLite GEOS, GDAL, PROJ.4, SpatiaLite 3.7.15+ Requires SpatiaLite 4.1+ ================== ============================== ================== ========================================= See also `this comparison matrix`__ on the OSGeo Wiki for diff --git a/docs/ref/models/indexes.txt b/docs/ref/models/indexes.txt index b751989e0c8d7..daecdd7f9ad17 100644 --- a/docs/ref/models/indexes.txt +++ b/docs/ref/models/indexes.txt @@ -40,12 +40,6 @@ For example ``Index(fields=['headline', '-pub_date'])`` would create SQL with ``(headline, pub_date DESC)``. Index ordering isn't supported on MySQL. In that case, a descending index is created as a normal index. -.. admonition:: Support for column ordering on SQLite - - Column ordering is supported on SQLite 3.3.0+ and only for some database - file formats. Refer to the `SQLite docs - `_ for specifics. - ``name`` -------- diff --git a/docs/topics/db/transactions.txt b/docs/topics/db/transactions.txt index eb2b02046c9e4..272423d80cbde 100644 --- a/docs/topics/db/transactions.txt +++ b/docs/topics/db/transactions.txt @@ -487,9 +487,9 @@ Savepoints A savepoint is a marker within a transaction that enables you to roll back part of a transaction, rather than the full transaction. Savepoints are -available with the SQLite (≥ 3.6.8), PostgreSQL, Oracle and MySQL (when using -the InnoDB storage engine) backends. Other backends provide the savepoint -functions, but they're empty operations -- they don't actually do anything. +available with the SQLite, PostgreSQL, Oracle, and MySQL (when using the InnoDB +storage engine) backends. Other backends provide the savepoint functions, but +they're empty operations -- they don't actually do anything. Savepoints aren't especially useful if you are using autocommit, the default behavior of Django. However, once you open a transaction with :func:`atomic`, @@ -582,8 +582,8 @@ Database-specific notes Savepoints in SQLite -------------------- -While SQLite ≥ 3.6.8 supports savepoints, a flaw in the design of the -:mod:`sqlite3` module makes them hardly usable. +While SQLite supports savepoints, a flaw in the design of the :mod:`sqlite3` +module makes them hardly usable. When autocommit is enabled, savepoints don't make sense. When it's disabled, :mod:`sqlite3` commits implicitly before savepoint statements. (In fact, it diff --git a/docs/topics/testing/overview.txt b/docs/topics/testing/overview.txt index b7deb95ee159b..357ec9d790b2e 100644 --- a/docs/topics/testing/overview.txt +++ b/docs/topics/testing/overview.txt @@ -177,7 +177,7 @@ control the particular collation used by the test database. See the :doc:`settings documentation ` for details of these and other advanced settings. -If using an SQLite in-memory database with SQLite 3.7.13+, `shared cache +If using an SQLite in-memory database with SQLite, `shared cache `_ is enabled, so you can write tests with ability to share the database between threads. diff --git a/tests/expressions_case/tests.py b/tests/expressions_case/tests.py index 090607e8b8cb3..16c8a3d546f5e 100644 --- a/tests/expressions_case/tests.py +++ b/tests/expressions_case/tests.py @@ -5,7 +5,7 @@ from uuid import UUID from django.core.exceptions import FieldError -from django.db import connection, models +from django.db import models from django.db.models import F, Max, Min, Q, Sum, Value from django.db.models.expressions import Case, When from django.test import TestCase @@ -296,12 +296,6 @@ def test_combined_expression(self): transform=attrgetter('integer', 'test') ) - if connection.vendor == 'sqlite' and connection.Database.sqlite_version_info < (3, 7, 0): - # There is a bug in sqlite < 3.7.0, where placeholder order is lost. - # Thus, the above query returns + - # for each matching case instead of + 1 (#24148). - test_combined_expression = unittest.expectedFailure(test_combined_expression) - def test_in_subquery(self): self.assertQuerysetEqual( CaseTestModel.objects.filter(