summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShai Berger <shai@platonix.com>2014-06-14 00:43:49 +0300
committerShai Berger <shai@platonix.com>2014-06-14 00:53:27 +0300
commit4b922b809413eb9e9d59be0c3b41d0cedefbeb29 (patch)
tree3b6674059fcf3cd28ec07c01711d7ef51a766a13
parent1cb5dfe05f4e8363a7cf39d400e328f4b1c33366 (diff)
[1.7.x] Fixed #22816 -- Corrected Oracle feature flag and fixed introspection test
Backport of 6122904 from master
-rw-r--r--django/db/backends/__init__.py4
-rw-r--r--django/db/backends/oracle/base.py1
-rw-r--r--tests/introspection/tests.py5
3 files changed, 6 insertions, 4 deletions
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py
index a566340b7b..93b74896a0 100644
--- a/django/db/backends/__init__.py
+++ b/django/db/backends/__init__.py
@@ -666,6 +666,10 @@ class BaseDatabaseFeatures(object):
can_introspect_max_length = True
# Can the backend determine reliably if a field is nullable?
+ # Note that this is separate from interprets_empty_strings_as_nulls,
+ # although the latter feature, when true, interferes with correct
+ # setting (and introspection) of CharFields' nullability.
+ # This is True for all core backends.
can_introspect_null = True
# Confirm support for introspected foreign keys
diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py
index 98db0c888a..3260eee0bd 100644
--- a/django/db/backends/oracle/base.py
+++ b/django/db/backends/oracle/base.py
@@ -111,7 +111,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
supports_tablespaces = True
supports_sequence_reset = False
can_introspect_max_length = False
- can_introspect_null = False
can_introspect_time_field = False
atomic_transactions = False
supports_combined_alters = False
diff --git a/tests/introspection/tests.py b/tests/introspection/tests.py
index 432658c21f..03962b33bf 100644
--- a/tests/introspection/tests.py
+++ b/tests/introspection/tests.py
@@ -73,15 +73,14 @@ class IntrospectionTests(TestCase):
[30, 30, 75]
)
- # The following test fails on Oracle. Since it forces null=True under the
- # hood in some cases, its idea about null_ok is different from ours.
@skipUnlessDBFeature('can_introspect_null')
def test_get_table_description_nullable(self):
with connection.cursor() as cursor:
desc = connection.introspection.get_table_description(cursor, Reporter._meta.db_table)
+ nullable_by_backend = connection.features.interprets_empty_strings_as_nulls
self.assertEqual(
[r[6] for r in desc],
- [False, False, False, False, True, True]
+ [False, nullable_by_backend, nullable_by_backend, nullable_by_backend, True, True]
)
# Regression test for #9991 - 'real' types in postgres