Opened 3 years ago

Closed 3 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: master
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


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

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 Changed 3 years ago by Michael Manfre

Needs documentation: unset
Needs tests: unset
Owner: changed from nobody to anonymous
Patch needs improvement: unset
Status: newassigned

comment:2 Changed 3 years ago by Michael Manfre

Owner: changed from anonymous to Michael Manfre

comment:3 Changed 3 years ago by Michael Manfre

Easy pickings: set
Has patch: set

comment:4 Changed 3 years ago by Anssi Kääriäinen

Triage Stage: UnreviewedReady for checkin

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

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

Resolution: fixed
Status: assignedclosed

In c89d80e2cc9bf1f401aa3af4047bdc6f3dc5bfa4:

Fixed #21097 - Added DatabaseFeature.can_introspect_autofield

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