1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

[1.11.x] Fixed #28792 -- Fixed index name truncation of namespaced tables.

Refs #27458, #27843.

Thanks Tim and Mariusz for the review.

Backport of ee85ef8315 from master
This commit is contained in:
Simon Charette
2017-11-11 19:17:20 -05:00
parent afcde50497
commit a35ab95ed4
5 changed files with 61 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
from django.core.exceptions import ImproperlyConfigured
from django.db.backends.utils import truncate_name
from django.db.backends.utils import split_identifier, truncate_name
from django.db.utils import load_backend
from django.test import SimpleTestCase
from django.utils import six
@@ -25,3 +25,9 @@ class TestLoadBackend(SimpleTestCase):
self.assertEqual(truncate_name('username"."some_table', 10), 'username"."some_table')
self.assertEqual(truncate_name('username"."some_long_table', 10), 'username"."some_la38a')
self.assertEqual(truncate_name('username"."some_long_table', 10, 3), 'username"."some_loa38')
def test_split_identifier(self):
self.assertEqual(split_identifier('some_table'), ('', 'some_table'))
self.assertEqual(split_identifier('"some_table"'), ('', 'some_table'))
self.assertEqual(split_identifier('namespace"."some_table'), ('namespace', 'some_table'))
self.assertEqual(split_identifier('"namespace"."some_table"'), ('namespace', 'some_table'))