Commit 61229040 authored by Shai Berger's avatar Shai Berger
Browse files

Fixed #22816 -- Corrected Oracle feature flag and fixed introspection test

parent 06c0e740
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -576,6 +576,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
+0 −1
Original line number Diff line number Diff line
@@ -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
+2 −3
Original line number Diff line number Diff line
@@ -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