Skip to content

Commit

Permalink
boulder-oracle-sprint: Fixed #3743 by not creating another index when
Browse files Browse the repository at this point in the history
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
Boulder Sprinters committed Apr 3, 2007
1 parent a305327 commit 5bcf13b
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion django/core/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ def get_sql_indexes_for_model(model):
output = []

for f in model._meta.fields:
if f.db_index:
if f.db_index and not (f.primary_key and backend.autoindexes_primary_keys):
unique = f.unique and 'UNIQUE ' or ''
output.append(
style.SQL_KEYWORD('CREATE %sINDEX' % unique) + ' ' + \
Expand Down
1 change: 1 addition & 0 deletions django/db/backends/ado_mssql/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def close(self):

allows_group_by_ordinal = True
allows_unique_and_pk = True
autoindexes_primary_keys = False
needs_datetime_string_cast = True
needs_upper_for_iops = False
supports_constraints = True
Expand Down
1 change: 1 addition & 0 deletions django/db/backends/mysql/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def get_server_version(self):

allows_group_by_ordinal = True
allows_unique_and_pk = True
autoindexes_primary_keys = False
needs_datetime_string_cast = True # MySQLdb requires a typecast for dates
needs_upper_for_iops = False
supports_constraints = True
Expand Down
1 change: 1 addition & 0 deletions django/db/backends/oracle/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def close(self):

allows_group_by_ordinal = False
allows_unique_and_pk = False # Suppress UNIQUE/PK for Oracle (ORA-02259)
autoindexes_primary_keys = True
needs_datetime_string_cast = False
needs_upper_for_iops = True
supports_constraints = True
Expand Down
1 change: 1 addition & 0 deletions django/db/backends/postgresql/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ def close(self):

allows_group_by_ordinal = True
allows_unique_and_pk = True
autoindexes_primary_keys = False
needs_datetime_string_cast = True
needs_upper_for_iops = False
supports_constraints = True
Expand Down
1 change: 1 addition & 0 deletions django/db/backends/postgresql_psycopg2/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def close(self):

allows_group_by_ordinal = True
allows_unique_and_pk = True
autoindexes_primary_keys = False
needs_datetime_string_cast = False
needs_upper_for_iops = False
supports_constraints = True
Expand Down
1 change: 1 addition & 0 deletions django/db/backends/sqlite3/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def convert_query(self, query, num_params):

allows_group_by_ordinal = True
allows_unique_and_pk = True
autoindexes_primary_keys = False
needs_datetime_string_cast = True
needs_upper_for_iops = False
supports_constraints = False
Expand Down

0 comments on commit 5bcf13b

Please sign in to comment.