summaryrefslogtreecommitdiff
path: root/django/db/backends/base/schema.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/backends/base/schema.py')
-rw-r--r--django/db/backends/base/schema.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/django/db/backends/base/schema.py b/django/db/backends/base/schema.py
index 3a83e14be9..070211f6d2 100644
--- a/django/db/backends/base/schema.py
+++ b/django/db/backends/base/schema.py
@@ -11,7 +11,7 @@ from django.db.backends.ddl_references import (
Statement,
Table,
)
-from django.db.backends.utils import names_digest, split_identifier
+from django.db.backends.utils import names_digest, split_identifier, truncate_name
from django.db.models import Deferrable, Index
from django.db.models.sql import Query
from django.db.transaction import TransactionManagementError, atomic
@@ -1760,7 +1760,11 @@ class BaseDatabaseSchemaEditor:
"""Return all constraint names matching the columns and conditions."""
if column_names is not None:
column_names = [
- self.connection.introspection.identifier_converter(name)
+ self.connection.introspection.identifier_converter(
+ truncate_name(name, self.connection.ops.max_name_length())
+ )
+ if self.connection.features.truncates_names
+ else self.connection.introspection.identifier_converter(name)
for name in column_names
]
with self.connection.cursor() as cursor: