summaryrefslogtreecommitdiff
path: root/tests/schema
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2017-11-11 19:17:20 -0500
committerSimon Charette <charette.s@gmail.com>2017-11-14 21:36:25 -0500
commitee85ef8315db839e5723dea19d8b971420a2ebb4 (patch)
tree437643db0fb2af8951b13b24308e591dacd9fa1f /tests/schema
parent532a4f22ad94db320cb0fd66f4c7ee57d17ac65a (diff)
Fixed #28792 -- Fixed index name truncation of namespaced tables.
Refs #27458, #27843. Thanks Tim and Mariusz for the review.
Diffstat (limited to 'tests/schema')
-rw-r--r--tests/schema/tests.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/schema/tests.py b/tests/schema/tests.py
index f2a96294cc..66a54b1ce4 100644
--- a/tests/schema/tests.py
+++ b/tests/schema/tests.py
@@ -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()