Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

boulder-oracle-sprint: Fixed #3743 by not creating another index when

the column is a PK and the backend is Oracle.


git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@4916 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 5bcf13b607ea92c34d13cbb52f70c1e6b76ce5cd 1 parent a305327
authored April 03, 2007
2  django/core/management.py
@@ -482,7 +482,7 @@ def get_sql_indexes_for_model(model):
482 482
     output = []
483 483
 
484 484
     for f in model._meta.fields:
485  
-        if f.db_index:
  485
+        if f.db_index and not (f.primary_key and backend.autoindexes_primary_keys):
486 486
             unique = f.unique and 'UNIQUE ' or ''
487 487
             output.append(
488 488
                 style.SQL_KEYWORD('CREATE %sINDEX' % unique) + ' ' + \
1  django/db/backends/ado_mssql/base.py
@@ -90,6 +90,7 @@ def close(self):
90 90
 
91 91
 allows_group_by_ordinal = True
92 92
 allows_unique_and_pk = True
  93
+autoindexes_primary_keys = False
93 94
 needs_datetime_string_cast = True
94 95
 needs_upper_for_iops = False
95 96
 supports_constraints = True
1  django/db/backends/mysql/base.py
@@ -133,6 +133,7 @@ def get_server_version(self):
133 133
 
134 134
 allows_group_by_ordinal = True
135 135
 allows_unique_and_pk = True
  136
+autoindexes_primary_keys = False
136 137
 needs_datetime_string_cast = True     # MySQLdb requires a typecast for dates
137 138
 needs_upper_for_iops = False
138 139
 supports_constraints = True
1  django/db/backends/oracle/base.py
@@ -68,6 +68,7 @@ def close(self):
68 68
 
69 69
 allows_group_by_ordinal = False
70 70
 allows_unique_and_pk = False        # Suppress UNIQUE/PK for Oracle (ORA-02259)
  71
+autoindexes_primary_keys = True
71 72
 needs_datetime_string_cast = False
72 73
 needs_upper_for_iops = True
73 74
 supports_constraints = True
1  django/db/backends/postgresql/base.py
@@ -106,6 +106,7 @@ def close(self):
106 106
 
107 107
 allows_group_by_ordinal = True
108 108
 allows_unique_and_pk = True
  109
+autoindexes_primary_keys = False
109 110
 needs_datetime_string_cast = True
110 111
 needs_upper_for_iops = False
111 112
 supports_constraints = True
1  django/db/backends/postgresql_psycopg2/base.py
@@ -74,6 +74,7 @@ def close(self):
74 74
 
75 75
 allows_group_by_ordinal = True
76 76
 allows_unique_and_pk = True
  77
+autoindexes_primary_keys = False
77 78
 needs_datetime_string_cast = False
78 79
 needs_upper_for_iops = False
79 80
 supports_constraints = True
1  django/db/backends/sqlite3/base.py
@@ -101,6 +101,7 @@ def convert_query(self, query, num_params):
101 101
 
102 102
 allows_group_by_ordinal = True
103 103
 allows_unique_and_pk = True
  104
+autoindexes_primary_keys = False
104 105
 needs_datetime_string_cast = True
105 106
 needs_upper_for_iops = False
106 107
 supports_constraints = False

0 notes on commit 5bcf13b

Please sign in to comment.
Something went wrong with that request. Please try again.