Opened 18 years ago
Closed 17 years ago
#5680 closed (fixed)
DatabaseFeatures.autoindexes_primary_key is unnecessary
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev |
| Severity: | Keywords: | db-be-api | |
| Cc: | Erin Kelly | Triage Stage: | Accepted |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
The db backend setting autoindexes_primary_key is unnecessary - since all backends do this.
Note that the changes necessary collide with my patch for #5671
2 patches attached:
- one that fixes this issue, against trunk
- one that combines this patch with the one for 5671.
Attachments (5)
Change History (15)
by , 18 years ago
| Attachment: | autoindex.diff added |
|---|
comment:2 by , 18 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:3 by , 18 years ago
| Cc: | added |
|---|
I just added another reference to the autoindexes_primary_keys feature, so I've updated this patch to reflect that.
comment:5 by , 17 years ago
| Keywords: | db-be-api added |
|---|
comment:6 by , 17 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:7 by , 17 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
This patch (with removed autoindexes_primary_keys feature) does not treat duplicated indexes and foreign key constraints on MySQL, whereas setting its value to True has solved it.
comment:8 by , 17 years ago
Please provide an example of how to duplicate the problem you are talking about. I tested the changes in [7790] fairly carefully with MySQL + InnoDB and couldn't create any duplicate indexes. So what case did I miss? Without more information I cannot hope to fix things.
by , 17 years ago
| Attachment: | models-mysql-duplicated-index-and-foreign-constraints.py added |
|---|
example demonstrating duplicated index and foreign key constraints on MySQL
by , 17 years ago
| Attachment: | r7811-mysql-duplicated-index-and-foreign-constraints.py added |
|---|
Generated SQL showing duplicated index and foreign key constraints on MySQL
comment:9 by , 17 years ago
After uploading example, I reviewed MySQL tables again and I notice that there is now redundant index actually. Instead, if index is not supplied explicitly, MySQL creates inherent one.
Perhaps I confused it with foreign key duplications in ticket #7186 seeing CONSTRAINTS and CREATE INDEX commands together.
Sorry for the noice...
comment:10 by , 17 years ago
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
I had just finished typing in a bunch of output to show exactly that. In both MySQL 4 and MySQL 5 it doesn't create the index implicitly if one is specified. There's no bug here.
Fixes just this issue