Opened 11 years ago

Closed 11 years ago

#21097 closed Bug (fixed)

IntrospectionTests incorrectly validates an AutoField as an IntegerField

Reported by: Michael Manfre Owned by: Michael Manfre
Component: Testing framework Version: dev
Severity: Normal Keywords: inspectdb
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The Reporter model doesn't have an explicitly defined primary_key and should have an implicit AutoField(primary_key=True) added to the model.

https://docs.djangoproject.com/en/dev/topics/db/models/#automatic-primary-key-fields

None of the core backends support introspecting an AutoField, but some 3rd party backends do (django-mssql). I propose adding a new DatabaseFeature can_introspect_autofield that allows backends to decide whether they can distinguish between an AutoField and an IntegerField.

Change History (5)

comment:1 by Michael Manfre, 11 years ago

Owner: changed from nobody to anonymous
Status: newassigned

comment:2 by Michael Manfre, 11 years ago

Owner: changed from anonymous to Michael Manfre

comment:3 by Michael Manfre, 11 years ago

Easy pickings: set
Has patch: set

comment:4 by Anssi Kääriäinen, 11 years ago

Triage Stage: UnreviewedReady for checkin

Seems to be ready. I can likely commit this tomorrow.

comment:5 by Anssi Kääriäinen <anssi.kaariainen@…>, 11 years ago

Resolution: fixed
Status: assignedclosed

In c89d80e2cc9bf1f401aa3af4047bdc6f3dc5bfa4:

Fixed #21097 - Added DatabaseFeature.can_introspect_autofield

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