From 0de0699d94ccd078c83eadef296a0d9ccd65a62f Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Sat, 28 Jan 2017 08:19:47 -0500 Subject: [PATCH] Fixed #27788 -- Dropped support for Oracle < 12.1. --- .../contrib/gis/db/backends/oracle/operations.py | 14 ++++---------- django/db/backends/base/features.py | 15 ++++++--------- django/db/backends/oracle/features.py | 15 --------------- docs/ref/contrib/gis/db-api.txt | 2 +- docs/ref/contrib/gis/functions.txt | 2 +- docs/ref/databases.txt | 2 +- docs/releases/2.0.txt | 7 +++++++ tests/gis_tests/geoapp/test_functions.py | 6 ++---- tests/schema/tests.py | 2 +- 9 files changed, 23 insertions(+), 42 deletions(-) diff --git a/django/contrib/gis/db/backends/oracle/operations.py b/django/contrib/gis/db/backends/oracle/operations.py index 6fc4fb69aa7..277a6a4b56f 100644 --- a/django/contrib/gis/db/backends/oracle/operations.py +++ b/django/contrib/gis/db/backends/oracle/operations.py @@ -17,7 +17,6 @@ from django.contrib.gis.db.models import aggregates from django.contrib.gis.geometry.backend import Geometry from django.contrib.gis.measure import Distance from django.db.backends.oracle.operations import DatabaseOperations -from django.utils.functional import cached_property DEFAULT_TOLERANCE = '0.05' @@ -132,15 +131,10 @@ class OracleOperations(BaseSpatialOperations, DatabaseOperations): truncate_params = {'relate': None} - @cached_property - def unsupported_functions(self): - unsupported = { - 'AsGeoJSON', 'AsKML', 'AsSVG', 'Envelope', 'ForceRHR', 'GeoHash', - 'MakeValid', 'MemSize', 'Scale', 'SnapToGrid', 'Translate', - } - if self.connection.oracle_full_version < '12.1.0.2': - unsupported.add('BoundingCircle') - return unsupported + unsupported_functions = { + 'AsGeoJSON', 'AsKML', 'AsSVG', 'Envelope', 'ForceRHR', 'GeoHash', + 'MakeValid', 'MemSize', 'Scale', 'SnapToGrid', 'Translate', + } def geo_quote_name(self, name): return super().geo_quote_name(name).upper() diff --git a/django/db/backends/base/features.py b/django/db/backends/base/features.py index 8f9fbdcfea3..d108dc13201 100644 --- a/django/db/backends/base/features.py +++ b/django/db/backends/base/features.py @@ -253,18 +253,15 @@ class BaseDatabaseFeatures: except NotImplementedError: return False - def introspected_boolean_field_type(self, field=None, created_separately=False): + def introspected_boolean_field_type(self, field=None): """ What is the type returned when the backend introspects a BooleanField? - The optional arguments may be used to give further details of the field to be - introspected; in particular, they are provided by Django's test suite: - field -- the field definition - created_separately -- True if the field was added via a SchemaEditor's AddField, - False if the field was created with the model + The `field` argument may be used to give further details of the field + to be introspected. - Note that return value from this function is compared by tests against actual - introspection results; it should provide expectations, not run an introspection - itself. + The return value from this function is compared by tests against actual + introspection results; it should provide expectations, not run an + introspection itself. """ if self.can_introspect_null and field and field.null: return 'NullBooleanField' diff --git a/django/db/backends/oracle/features.py b/django/db/backends/oracle/features.py index 0e85f267f2e..3e72a5c29dd 100644 --- a/django/db/backends/oracle/features.py +++ b/django/db/backends/oracle/features.py @@ -35,18 +35,3 @@ class DatabaseFeatures(BaseDatabaseFeatures): # Oracle doesn't ignore quoted identifiers case but the current backend # does by uppercasing all identifiers. ignores_table_name_case = True - - def introspected_boolean_field_type(self, field=None, created_separately=False): - """ - Some versions of Oracle -- we've seen this on 11.2.0.1 and suspect - it goes back -- have a weird bug where, when an integer column is - added to an existing table with a default, its precision is later - reported on introspection as 0, regardless of the real precision. - For Django introspection, this means that such columns are reported - as IntegerField even if they are really BigIntegerField or BooleanField. - - The bug is solved in Oracle 11.2.0.2 and up. - """ - if self.connection.oracle_full_version < '11.2.0.2' and field and field.has_default() and created_separately: - return 'IntegerField' - return super().introspected_boolean_field_type(field, created_separately) diff --git a/docs/ref/contrib/gis/db-api.txt b/docs/ref/contrib/gis/db-api.txt index daa32d75ec3..768c478835b 100644 --- a/docs/ref/contrib/gis/db-api.txt +++ b/docs/ref/contrib/gis/db-api.txt @@ -376,7 +376,7 @@ Function PostGIS Oracle MySQL Spat :class:`AsGML` X X X :class:`AsKML` X X :class:`AsSVG` X X -:class:`BoundingCircle` X X (≥ 12.1.0.2) +:class:`BoundingCircle` X X :class:`Centroid` X X X X :class:`Difference` X X X (≥ 5.6.1) X :class:`Distance` X X X (≥ 5.6.1) X diff --git a/docs/ref/contrib/gis/functions.txt b/docs/ref/contrib/gis/functions.txt index f60c3f3f6ee..c26e1ca9ae8 100644 --- a/docs/ref/contrib/gis/functions.txt +++ b/docs/ref/contrib/gis/functions.txt @@ -170,7 +170,7 @@ __ http://www.w3.org/Graphics/SVG/ .. class:: BoundingCircle(expression, num_seg=48, **extra) *Availability*: `PostGIS `__, -`Oracle (≥ 12.1.0.2) `_ +`Oracle `_ Accepts a single geographic field or expression and returns the smallest circle polygon that can fully contain the geometry. diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt index 0628cef2e11..26351314def 100644 --- a/docs/ref/databases.txt +++ b/docs/ref/databases.txt @@ -676,7 +676,7 @@ rather than a list. SQLite does not support this. Oracle notes ============ -Django supports `Oracle Database Server`_ versions 11.2 and higher. Version +Django supports `Oracle Database Server`_ versions 12.1 and higher. Version 5.2 or higher of the `cx_Oracle`_ Python driver is required. .. _`Oracle Database Server`: http://www.oracle.com/ diff --git a/docs/releases/2.0.txt b/docs/releases/2.0.txt index ca914118ca4..2ef6ba9be10 100644 --- a/docs/releases/2.0.txt +++ b/docs/releases/2.0.txt @@ -210,6 +210,13 @@ Database backend API * ... +Dropped support for Oracle 11.2 +------------------------------- + +The end of upstream support for Oracle 11.2 is Dec. 2020. Django 1.11 will be +supported until April 2020 which almost reaches this date. Django 2.0 +officially supports Oracle 12.1+. + Miscellaneous ------------- diff --git a/tests/gis_tests/geoapp/test_functions.py b/tests/gis_tests/geoapp/test_functions.py index 4d3913a7a3d..6b2a725ff76 100644 --- a/tests/gis_tests/geoapp/test_functions.py +++ b/tests/gis_tests/geoapp/test_functions.py @@ -305,10 +305,8 @@ class GISFunctionsTests(TestCase): for c in mpoly_qs: self.assertEqual(c.mpoly.num_points, c.num_points) - if not oracle: - # Oracle cannot count vertices in Point geometries. - for c in City.objects.annotate(num_points=functions.NumPoints('point')): - self.assertEqual(1, c.num_points) + for c in City.objects.annotate(num_points=functions.NumPoints('point')): + self.assertEqual(c.num_points, 1) @skipUnlessDBFeature("has_PointOnSurface_function") def test_point_on_surface(self): diff --git a/tests/schema/tests.py b/tests/schema/tests.py index 4f62333dbaf..d21f608e025 100644 --- a/tests/schema/tests.py +++ b/tests/schema/tests.py @@ -416,7 +416,7 @@ class SchemaTests(TransactionTestCase): field_type = columns['awesome'][0] self.assertEqual( field_type, - connection.features.introspected_boolean_field_type(new_field, created_separately=True) + connection.features.introspected_boolean_field_type(new_field) ) def test_add_field_default_transform(self):