mirror of
https://github.com/django/django.git
synced 2025-09-09 04:00:48 +00:00
Fixed #28792 -- Fixed index name truncation of namespaced tables.
Refs #27458, #27843. Thanks Tim and Mariusz for the review.
This commit is contained in:
parent
532a4f22ad
commit
ee85ef8315
5 changed files with 53 additions and 13 deletions
|
@ -2370,6 +2370,21 @@ class SchemaTests(TransactionTestCase):
|
|||
cast_function=lambda x: x.time(),
|
||||
)
|
||||
|
||||
def test_namespaced_db_table_create_index_name(self):
|
||||
"""
|
||||
Table names are stripped of their namespace/schema before being used to
|
||||
generate index names.
|
||||
"""
|
||||
with connection.schema_editor() as editor:
|
||||
max_name_length = connection.ops.max_name_length() or 200
|
||||
namespace = 'n' * max_name_length
|
||||
table_name = 't' * max_name_length
|
||||
namespaced_table_name = '"%s"."%s"' % (namespace, table_name)
|
||||
self.assertEqual(
|
||||
editor._create_index_name(table_name, []),
|
||||
editor._create_index_name(namespaced_table_name, []),
|
||||
)
|
||||
|
||||
@unittest.skipUnless(connection.vendor == 'oracle', 'Oracle specific db_table syntax')
|
||||
def test_creation_with_db_table_double_quotes(self):
|
||||
oracle_user = connection.creation._test_database_user()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue