Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#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)

postgres.patch (3.3 KB ) - added by Vlastimil Zíma 10 years ago.

Download all attachments as: .zip

Change History (13)

by Vlastimil Zíma, 10 years ago

Attachment: postgres.patch added

comment:1 by Tim Graham, 10 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Vlastimil Zíma, 10 years ago

Has patch: set
Owner: changed from nobody to Vlastimil Zíma
Status: newassigned
Triage Stage: AcceptedReady for checkin

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.

comment:3 by Tim Graham, 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 Vlastimil Zíma, 10 years ago

Triage Stage: Ready for checkinAccepted

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 Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In 78c32f1caa9cb9b28be2d867aff586a2016122ed:

Fixed #22514 -- Prevented indexes on virtual fields [postgres].

comment:6 by Vlastimil Zíma, 10 years ago

Is there any chance for a backport to 1.6? That version is also affected.

comment:7 by Tim Graham, 10 years ago

Not unless it's a regression from 1.5.

comment:8 by Tim Graham <timograham@…>, 10 years ago

In 6e5a7367524d3e3abd3d0f60f2e8a41796908101:

[1.7.x] Fixed #22514 -- Prevented indexes on virtual fields [postgres].

Backport of 78c32f1caa from master

comment:9 by Vlastimil Zíma, 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

comment:10 by Tim Graham <timograham@…>, 10 years ago

In 1892ced10a8c0a74a93acddecdb3329fc58a017b:

Added refs #22514 to 1.6.6 release notes.

comment:11 by Tim Graham <timograham@…>, 10 years ago

In ef3ae3d1c94ac1d4ffaeeeec1ee544e91431e65b:

[1.6.x] Fixed #22514 -- Prevented indexes on virtual fields [postgres].

Backport of 78c32f1caa from master

comment:12 by Tim Graham <timograham@…>, 10 years ago

In d107c7bd7db183d85bb3b22e0019b3be8af262d2:

[1.7.x] Added refs #22514 to 1.6.6 release notes.

Backport of 1892ced10a from master

Note: See TracTickets for help on using tickets.
Back to Top