Fixed problem introduced with #refs 13711.

This commit is contained in:
Anubhav Joshi 2014-06-20 10:30:04 +05:30 committed by Shai Berger
parent 908160f692
commit 1c50d6ae2b
4 changed files with 7 additions and 2 deletions

View File

@ -520,6 +520,10 @@ class BaseDatabaseFeatures(object):
# at the end of each save operation? # at the end of each save operation?
supports_forward_references = True supports_forward_references = True
# Does the backend uses proper method like 'truncate_name'
# to auto-truncate column names?
truncates_name = False
# Is there a REAL datatype in addition to floats/doubles? # Is there a REAL datatype in addition to floats/doubles?
has_real_datatype = False has_real_datatype = False
supports_subqueries_in_group_by = True supports_subqueries_in_group_by = True

View File

@ -107,6 +107,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
supports_bitwise_or = False supports_bitwise_or = False
can_defer_constraint_checks = True can_defer_constraint_checks = True
supports_partially_nullable_unique_constraints = False supports_partially_nullable_unique_constraints = False
truncates_name = True
has_bulk_insert = True has_bulk_insert = True
supports_tablespaces = True supports_tablespaces = True
supports_sequence_reset = False supports_sequence_reset = False

View File

@ -1469,7 +1469,7 @@ class Model(six.with_metaclass(ModelBase)):
continue continue
connection = connections[db] connection = connections[db]
max_name_length = connection.ops.max_name_length() max_name_length = connection.ops.max_name_length()
if max_name_length is None: if max_name_length is None or connection.features.truncates_name:
continue continue
else: else:
if allowed_len is None: if allowed_len is None:

View File

@ -18,7 +18,7 @@ def get_max_column_name_length():
for db in settings.DATABASES.keys(): for db in settings.DATABASES.keys():
connection = connections[db] connection = connections[db]
max_name_length = connection.ops.max_name_length() max_name_length = connection.ops.max_name_length()
if max_name_length is None: if max_name_length is None or connection.features.truncates_name:
continue continue
else: else:
if allowed_len is None: if allowed_len is None: