1
0
mirror of https://github.com/django/django.git synced 2025-10-29 00:26:07 +00:00

[1.7.x] Fixed #22514 -- Prevented indexes on virtual fields [postgres].

Backport of 78c32f1caa from master
This commit is contained in:
Vlastimil Zíma
2014-05-19 18:19:35 +02:00
committed by Tim Graham
parent d9a83d597e
commit 6e5a736752
3 changed files with 34 additions and 2 deletions

View File

@@ -29,3 +29,10 @@ class IndexesTests(TestCase):
# unique=True and db_index=True should only create the varchar-specific
# index (#19441).
self.assertIn('("slug" varchar_pattern_ops)', index_sql[4])
@skipUnless(connection.vendor == 'postgresql',
"This is a postgresql-specific issue")
def test_postgresql_virtual_relation_indexes(self):
"""Test indexes are not created for related objects"""
index_sql = connection.creation.sql_indexes_for_model(Article, no_style())
self.assertEqual(len(index_sql), 1)