ignored field index creation for fields with unique=True and db_index=True
|Reported by:||jordi||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.2|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
If I have a field in my model like;
field = models.CharField(max_length=4, unique=True, db_index=True)
function sql_indexes_for_field from db/backends/creation.py will silently ignore creation the index for that field.
I think it show be created or, at least, give a message that it will not be created and some reason.
To create an index for such a field I have to remove "unique=True", create
the index whith "python manage.py sqlindexes <app>" and after add again "unique=True", so django admin captures
non unique entries. I am using sqlite.
Change History (4)
comment:1 Changed 6 years ago by ramiro
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Resolution set to invalid
- Status changed from new to closed
comment:3 Changed 6 years ago by jordi
- Resolution invalid deleted
- Status changed from closed to reopened