mirror of https://github.com/django/django.git
Fixed #27788 -- Dropped support for Oracle < 12.1.
This commit is contained in:
parent
a6755b29e9
commit
0de0699d94
|
@ -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 = {
|
||||
unsupported_functions = {
|
||||
'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
|
||||
|
||||
def geo_quote_name(self, name):
|
||||
return super().geo_quote_name(name).upper()
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -170,7 +170,7 @@ __ http://www.w3.org/Graphics/SVG/
|
|||
.. class:: BoundingCircle(expression, num_seg=48, **extra)
|
||||
|
||||
*Availability*: `PostGIS <http://postgis.net/docs/ST_MinimumBoundingCircle.html>`__,
|
||||
`Oracle (≥ 12.1.0.2) <https://docs.oracle.com/database/121/SPATL/GUID-82A61626-BB64-4793-B53D-A0DBEC91831A.htm#SPATL1554>`_
|
||||
`Oracle <https://docs.oracle.com/database/121/SPATL/GUID-82A61626-BB64-4793-B53D-A0DBEC91831A.htm#SPATL1554>`_
|
||||
|
||||
Accepts a single geographic field or expression and returns the smallest circle
|
||||
polygon that can fully contain the geometry.
|
||||
|
|
|
@ -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/
|
||||
|
|
|
@ -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
|
||||
-------------
|
||||
|
||||
|
|
|
@ -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)
|
||||
self.assertEqual(c.num_points, 1)
|
||||
|
||||
@skipUnlessDBFeature("has_PointOnSurface_function")
|
||||
def test_point_on_surface(self):
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue