#22514 closed Bug (fixed)
Postgres index generator does not expect db_type to be None
Reported by: | Vlastimil Zíma | Owned by: | Vlastimil Zíma |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.6 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Postgres database backend does not expect fields with db_type None
in index creation.
Virtual foreign relation can have unique set up to enable model-instance cache. I attach a patch and a test.
Attachments (1)
Change History (13)
by , 11 years ago
Attachment: | postgres.patch added |
---|
comment:1 by , 11 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 11 years ago
Has patch: | set |
---|---|
Owner: | changed from | to
Status: | new → assigned |
Triage Stage: | Accepted → Ready for checkin |
comment:3 by , 10 years ago
In the future, please do not mark your own patch as "Ready for checkin". You need to get a second set of eyes to review the patch and then that person can do that. While I don't object to fixing this and am looking at it, note the following deprecation for 2.0: "The DatabaseCreation class on each database backend will be removed, and all table/schema editing will be moved to be via SchemaEditor instead." I guess you may want to see if this issue exists there as well.
comment:4 by , 10 years ago
Triage Stage: | Ready for checkin → Accepted |
---|
Sorry, I mixed it up with "Ready for code review".
I've run into this issue in 1.6. There is a chance this bug lives on multiple places, but I'd be happier if somebody more familiar with the ORM core check it out.
comment:5 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:6 by , 10 years ago
Is there any chance for a backport to 1.6? That version is also affected.
comment:9 by , 10 years ago
Found it. It is a regression from 1.5. This is the commit which introduced the bug:
https://github.com/django/django/commit/c698c55966ed9179828857398d27bf69e64713a2
I've made a PR from the patch.
PR: https://github.com/django/django/pull/2687
This patch only patches up the postgres issue. It might be worth to not generate indexes on virtual fields in general.